How are soap envelopes generated and why would .NET and php clients produce/receive different soap envelopes?

Active3 hr before
Viewed126 times

6 Answers


Meta Stack Overflow , Stack Overflow Public questions & answers , Stack Overflow help chat ,Making statements based on opinion; back them up with references or personal experience.

php request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:ns1="">
            blah blah blah
load more v

The envelope element is the mandatory element in the SOAP message and is used to encapsulate all of the data in the SOAP message.,Every SOAP message needs to have a root Envelope element. It is absolutely mandatory for SOAP message to have an envelope element.,The SOAP building blocks consist of a SOAP Message. Each SOAP message consists of an envelope element, a header, and a body element.,As discussed in the previous topic of this SOAP tutorial, a simple SOAP Message has the following elements –

The complex type is defined by the element tag <xsd:complexType>. All of the required elements of the structure along with their respective data types are then defined in the complex type collection.

      <xsd:element name="Tutorial Name" type="string" />
      <xsd:element name="Tutorial Description" type="string" />
load more v

Being protocol-agnostic, SOAP is unable to take advantage of protocol-specific features and optimizations such as REST's Uniform Interface or caching – instead having to reimplement them (as with WS-Addressing).,In financial messaging SOAP was found to result in a 2–4 times larger message than previous protocols FIX (Financial Information Exchange) and CDR (Common Data Representation).[18] ,a set of encoding rules for expressing instances of application-defined datatypes,SOAP (formerly an acronym for Simple Object Access Protocol) is a messaging protocol specification for exchanging structured information in the implementation of web services in computer networks. It uses XML Information Set for its message format, and relies on application layer protocols, most often Hypertext Transfer Protocol (HTTP), although some legacy systems communicate over Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission.

POST /InStock HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 299
SOAPAction: ""

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="" xmlns:m="">

SOAP Functionsis_soap_fault — Checks if a SOAP call has faileduse_soap_error_handler — Set whether to use the SOAP error handler,SoapClient::__setLocation — Sets the location of the Web service to use,use_soap_error_handler — Set whether to use the SOAP error handler,SoapClient::__call — Calls a SOAP function (deprecated)

PROBLEM(with SOAP extension under PHP5) of transferring object, that contains objects or array of objects.Nested object would not transfer.SOLUTION: This class was developed by trial and error by me.So this 23 lines of code
for most developers writing under PHP5 solves fate of using SOAP extension. < ? php /*According to specific of organization process of SOAP class in PHP5, we must wrap up complex objects in SoapVar class. Otherwise objects would not be encoded properly and could not be loaded on remote SOAP handler.Function "getAsSoap" call for encoding object for transmission. After encoding it can be properly transmitted.*/ abstract class SOAPable {
   function getAsSOAP() {
      foreach($this as $key => & $value) {
         $this - > prepareSOAPrecursive($this - > $key);
      return $this;
   function prepareSOAPrecursive( & $element) {
      if (is_array($element)) {
         foreach($element as $key => & $val) {
            $this - > prepareSOAPrecursive($val);
         $element = new SoapVar($element, SOAP_ENC_ARRAY);
      elseif(is_object($element)) {
         if ($element instanceof SOAPable) {
            $element - > getAsSOAP();
         $element = new SoapVar($element, SOAP_ENC_OBJECT);
} // ------------------------------------------//  ABSTRACT EXAMPLE// ------------------------------------------class PersonList extends SOAPable {  protected $ArrayOfPerson; // variable MUST be protected or public!}class Person extends SOAPable {   //any data} $client=new SoapClient("test.wsdl", array( 'soap_version'=>SOAP_1_2, 'trace'=>1, 'classmap' => array('Person' => "Person", 'PersonList' => "PersonList")  ));$PersonList=new PersonList;// some actions$PersonList->getAsSOAP();$client->someMethod($PersonList);?>So every class, which will transfer via SOAP, must be extends from class SOAPable.  As you can see, in code above, function prepareSOAPrecursive search another nested objects in parent object or in arrays, and if does it, tries call function getAsSOAP() for preparation of nested objects, after that simply wrap up via SoapVar class.So in code before transmitting simply call $obj->getAsSOAP()
load more v

SOAP web services in Oracle Applications Cloud can be invoked by using various clients.,Use the various features of .NET framework to integrate with the web services in Oracle Applications Cloud.,Use Ruby to invoke web services using SOAP clients such as Savon.,Use Python to invoke web services using various techniques such as urllib2 to create a HTTP request and Suds client.

load more v

To start, let’s give a little background as to what SOAP is.,However, if you think about it, SOAP is not that complex, and, also, ASP.NET Core is very easy to extend.,WCF was Microsoft’s flagship technology for implementing web services, be it SOAP, REST or whatever you would like.,Microsoft wrote a blog post about implementing a middleware component capable of handling SOAP requests.

A simple example is in order, first, the contract:

public interface IPingService {
   string Ping(string msg);
load more v

Other "different-generated" queries related to "How are soap envelopes generated and why would .NET and php clients produce/receive different soap envelopes?"