Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:24:45+00:00 2026-06-09T12:24:45+00:00

I am having trouble getting a SOAP request out. I’m using generated client code

  • 0

I am having trouble getting a SOAP request out. I’m using generated client code that in turn uses SoapClient in WSDL mode. I can make the initial session start call, but when I make another call, the namespaces appear to be out of whack.

Here is the SOAP request from SoapUI that works:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://vendor_uri/">
   <soapenv:Header/>
   <soapenv:Body>
      <wsdl:GetProducts>
         <GetProductsRequest>
            <UserInfo Token="XXXXX"/>
            <ClientReferenceData Service="pinless_dialing"/>
         </GetProductsRequest>
      </wsdl:GetProducts>
   </soapenv:Body>
</soapenv:Envelope>

And here’s the XML request generated by SoapClient (via Wireshark):

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="" xmlns:ns2="http://vendor_uri/">
    <SOAP-ENV:Body>
        <ns2:GetProducts>
            <GetProductsRequest>
                <ns1:UserInfo Token="XXXXX"/>
                <ns1:ClientReferenceData Service="pinless_dialing"/>
            </GetProductsRequest>
        </ns2:GetProducts>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The problem appears to be in the ns1 namespace. If I take that same request, and strip out that namespace, the call goes through SoapUI without a hitch.

Again, this is being generated by SoapClient pretty much directly. Here’s the relevant code from the generated code:

class B2BServiceSoapClient{
    /**
     * The WSDL URI
     *
     * @var string
     */
    public static $_WsdlUri='http://vendor_wsdl_uri';
    /**
     * The PHP SoapClient object
     *
     * @var object
     */
    public static $_Server=null;

    /**
     * Send a SOAP request to the server
     *
     * @param string $method The method name
     * @param array $param The parameters
     * @return mixed The server response
     */
    public static function _Call($method,$param){
        if(is_null(self::$_Server))
            self::$_Server=new SoapClient(self::$_WsdlUri);
        return self::$_Server->__soapCall($method,$param);
    }

The rest of the class consists of type definitions to mirror the WSDL.

Here is the code I use to exercise the class:

<pre>
<?php
ini_set('soap.wsdl_cache_enabled',0);

require_once('BossILDClient.php');

$client = new B2BServiceSoapClient();
$sessionToken = new UserInfoType();
$parameters = new SessionStart();
$parameters->UserInfo = new UserInfoType();
$parameters->UserInfo->UserName = 'username';
$parameters->UserInfo->Password = 'password';

echo "Calling SessionStart(" . print_r($parameters, true) . ")" . PHP_EOL . PHP_EOL;

$result = $client->SessionStart($parameters);
$sessionToken->Token = $result->SessionStartResponse->Result->Token; 

echo "REQUEST HEADER:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastRequestHeaders()) . "\n";
echo "REQUEST:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastRequest()) . "\n";
echo "RESPONSE HEADER:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastResponseHeaders()) . "\n";
echo "RESPONSE:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastResponse()) . "\n";

$getProducts = new GetProducts();
$getProducts->GetProductsRequest = new GetProductsRequestType();
$getProducts->GetProductsRequest->ClientReferenceData = new ClientReferenceDataType();
$getProducts->GetProductsRequest->ClientReferenceData->Service = 'pinless_dialing';
$getProducts->GetProductsRequest->UserInfo = $sessionToken;

echo "Calling GetProducts(" . print_r($getProducts, true) . ")" . PHP_EOL . PHP_EOL;

try {
    $result = $client->GetProducts($getProducts);
} catch(SoapFault $sf) {
    echo "SOAP Fault error!!!" . PHP_EOL . PHP_EOL;
}

echo "REQUEST HEADER:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastRequestHeaders()) . "\n";
echo "REQUEST:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastRequest()) . "\n";
echo "RESPONSE HEADER:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastResponseHeaders()) . "\n";
echo "RESPONSE:\n" . htmlentities(B2BServiceSoapClient::$_Server->__getLastResponse()) . "\n";
?>
</pre>

I have exhausted my wild guesses and considered thoughts to no avail. How can I prevent that “inner” namespace?

Here’s the direct output from the code above:

Calling SessionStart(SessionStart Object
(
    [UserInfo] => UserInfoType Object
        (
            [UserName] => username
            [Password] => password
            [Token] => 
        )

)
)

REQUEST HEADER:
POST /b2bapi/b2bservice.asmx HTTP/1.1
Host: 169.132.165.178
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.4.4
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://wsdl.idt.b2bapi.net/SessionStart"
Content-Length: 300


REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://wsdl.idt.b2bapi.net/">
  <SOAP-ENV:Body>
    <ns1:SessionStart>
      <UserInfo UserName="username" Password="password"/>
    </ns1:SessionStart>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

RESPONSE HEADER:
HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Length: 494
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
Set-Cookie: PSFSecKeyPart=XXXXXX; expires=Thu, 09-Aug-2012 19:56:39 GMT; path=/
X-Powered-By: ASP.NET
Date: Thu, 09 Aug 2012 19:36:39 GMT

RESPONSE:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <SessionStartResponse xmlns="http://wsdl.idt.b2bapi.net/">
      <SessionStartResponse xmlns="">
        <ResponseReferenceData Success="Y">
          <MessageList />
        </ResponseReferenceData>
        <Result Token="XXXXXX" />
      </SessionStartResponse>
    </SessionStartResponse>
  </soap:Body>
</soap:Envelope>

Calling GetProducts(GetProducts Object
(
    [GetProductsRequest] => GetProductsRequestType Object
        (
            [UserInfo] => UserInfoType Object
                (
                    [UserName] => 
                    [Password] => 
                    [Token] => XXXXXX
                )

            [ClientReferenceData] => ClientReferenceDataType Object
                (
                    [ClientTransactionID] => 
                    [Service] => pinless_dialing
                    [IP] => 
                    [TimeStamp] => 
                )

            [Parameters] => 
        )

)
)

SOAP Fault error!!!

REQUEST HEADER:
POST /b2bapi/b2bservice.asmx HTTP/1.1
Host: 169.132.165.178
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.4.4
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://wsdl.idt.b2bapi.net/GetProducts"
Content-Length: 394
Cookie: PSFSecKeyPart=XXXXXX;


REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="" xmlns:ns2="http://wsdl.idt.b2bapi.net/">
  <SOAP-ENV:Body>
    <ns2:GetProducts>
      <GetProductsRequest>
        <ns1:UserInfo Token="XXXXXX"/>
        <ns1:ClientReferenceData Service="pinless_dialing"/>
      </GetProductsRequest>
    </ns2:GetProducts>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

RESPONSE HEADER:
HTTP/1.1 400 Bad Request
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 09 Aug 2012 19:36:39 GMT

RESPONSE:

Here’s the whittled-down WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://wsdl.idt.b2bapi.net/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://wsdl.idt.b2bapi.net/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:documentation>IDT B2BService</wsdl:documentation>
   <wsdl:types>
      <s:schema elementFormDefault="qualified" targetNamespace="http://wsdl.idt.b2bapi.net/">
         <s:import/>
         <s:element name="GetProducts">
            <s:complexType>
               <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" ref="GetProductsRequest"/>
               </s:sequence>
            </s:complexType>
         </s:element>
         <s:element name="GetProductsResponse">
            <s:complexType>
               <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" ref="GetProductsResponse"/>
               </s:sequence>
            </s:complexType>
         </s:element>
         <s:element name="SessionStart">
            <s:complexType>
               <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" ref="UserInfo"/>
               </s:sequence>
            </s:complexType>
         </s:element>
         <s:element name="SessionStartResponse">
            <s:complexType>
               <s:sequence>
                  <s:element minOccurs="0" maxOccurs="1" ref="SessionStartResponse"/>
               </s:sequence>
            </s:complexType>
         </s:element>
      </s:schema>
      <s:schema elementFormDefault="qualified">
         <s:complexType name="UserInfoType">
            <s:attribute name="UserName" type="s:string"/>
            <s:attribute name="Password" type="s:string"/>
            <s:attribute name="Token" type="s:string"/>
         </s:complexType>
         <s:complexType name="ClientReferenceDataType">
            <s:attribute name="ClientTransactionID" type="s:string"/>
            <s:attribute name="Service" type="enumService" use="required"/>
            <s:attribute name="IP" type="s:string"/>
            <s:attribute name="TimeStamp" type="s:dateTime" use="required"/>
         </s:complexType>
         <s:simpleType name="enumService">
            <s:restriction base="s:string">
               <s:enumeration value="pinless_dialing"/>
               <s:enumeration value="imtu"/>
               <s:enumeration value="remittance"/>
               <s:enumeration value="virtual_visa"/>
            </s:restriction>
         </s:simpleType>
         <s:complexType name="ResponseReferenceDataType">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="1" name="MessageList" type="ArrayOfMessageType"/>
            </s:sequence>
            <s:attribute name="Success" type="s:string"/>
            <s:attribute name="TransactionID" type="s:string"/>
            <s:attribute name="ClientTransactionID" type="s:string"/>
         </s:complexType>
         <s:complexType name="ArrayOfMessageType">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="unbounded" name="Message" type="MessageType"/>
            </s:sequence>
         </s:complexType>
         <s:complexType name="MessageType">
            <s:attribute name="PlatformCode" type="s:string"/>
            <s:attribute name="Service" type="s:string"/>
            <s:attribute name="Command" type="s:string"/>
            <s:attribute name="StatusCode" type="s:string"/>
            <s:attribute name="StatusText" type="s:string"/>
         </s:complexType>
         <s:element name="GetProductsRequest" type="GetProductsRequestType"/>
         <s:complexType name="GetProductsRequestType">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="1" name="UserInfo" type="UserInfoType"/>
               <s:element minOccurs="0" maxOccurs="1" name="ClientReferenceData" type="ClientReferenceDataType"/>
               <s:element minOccurs="0" maxOccurs="1" name="Parameters" type="GetProductsParametersType"/>
            </s:sequence>
         </s:complexType>
         <s:complexType name="GetProductsParametersType">
            <s:attribute name="DataType" type="s:string"/>
         </s:complexType>
         <s:element name="GetProductsResponse" type="GetProductsResponseType"/>
         <s:complexType name="GetProductsResponseType">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="1" name="ResponseReferenceData" type="ResponseReferenceDataType"/>
               <s:element minOccurs="0" maxOccurs="1" name="ProductList" type="ArrayOfProductListTypeProduct"/>
            </s:sequence>
         </s:complexType>
         <s:complexType name="ArrayOfProductListTypeProduct">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="unbounded" name="Product">
                  <s:complexType>
                     <s:sequence>
                        <s:element minOccurs="0" maxOccurs="1" name="ProductCountryList" type="ArrayOfProductCountryTypeProductCountry"/>
                     </s:sequence>
                     <s:attribute name="Code" type="s:string"/>
                     <s:attribute name="Name" type="s:string"/>
                     <s:attribute name="DisplayName" type="s:string"/>
                     <s:attribute default="0" name="Denomination" type="s:integer"/>
                     <s:attribute name="Default" type="s:string"/>
                  </s:complexType>
               </s:element>
            </s:sequence>
         </s:complexType>
         <s:complexType name="ArrayOfProductCountryTypeProductCountry">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="unbounded" name="ProductCountry">
                  <s:complexType>
                     <s:sequence>
                        <s:element minOccurs="0" maxOccurs="1" name="CarrierList" type="ArrayOfCarrierTypeCarrier"/>
                     </s:sequence>
                     <s:attribute name="CountryCode" type="s:string"/>
                     <s:attribute name="CountryName" type="s:string"/>
                  </s:complexType>
               </s:element>
            </s:sequence>
         </s:complexType>
         <s:complexType name="ArrayOfCarrierTypeCarrier">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="unbounded" name="Carrier">
                  <s:complexType>
                     <s:attribute name="CarrierCode" type="s:string"/>
                     <s:attribute name="CarrierName" type="s:string"/>
                  </s:complexType>
               </s:element>
            </s:sequence>
         </s:complexType>
         <s:element name="UserInfo" type="UserInfoType"/>
         <s:element name="SessionStartResponse" type="SessionStartResponseType"/>
         <s:complexType name="SessionStartResponseType">
            <s:sequence>
               <s:element minOccurs="0" maxOccurs="1" name="ResponseReferenceData" type="ResponseReferenceDataType"/>
               <s:element minOccurs="0" maxOccurs="1" name="Result" type="SessionStartResultType"/>
            </s:sequence>
         </s:complexType>
         <s:complexType name="SessionStartResultType">
            <s:attribute name="Token" type="s:string"/>
         </s:complexType>
         <s:element name="ResponseReferenceData" type="ResponseReferenceDataType"/>
      </s:schema>
   </wsdl:types>
   <wsdl:message name="GetProductsSoapIn">
      <wsdl:part name="parameters" element="tns:GetProducts"/>
   </wsdl:message>
   <wsdl:message name="GetProductsSoapOut">
      <wsdl:part name="parameters" element="tns:GetProductsResponse"/>
   </wsdl:message>
   <wsdl:message name="SessionStartSoapIn">
      <wsdl:part name="parameters" element="tns:SessionStart"/>
   </wsdl:message>
   <wsdl:message name="SessionStartSoapOut">
      <wsdl:part name="parameters" element="tns:SessionStartResponse"/>
   </wsdl:message>
   <wsdl:portType name="B2BServiceSoap">
      <wsdl:operation name="GetProducts">
         <wsdl:input message="tns:GetProductsSoapIn"/>
         <wsdl:output message="tns:GetProductsSoapOut"/>
      </wsdl:operation>
      <wsdl:operation name="SessionStart">
         <wsdl:input message="tns:SessionStartSoapIn"/>
         <wsdl:output message="tns:SessionStartSoapOut"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="B2BServiceSoap" type="tns:B2BServiceSoap">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="GetProducts">
         <soap:operation soapAction="http://wsdl.idt.b2bapi.net/GetProducts" style="document"/>
         <wsdl:input>
            <soap:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="SessionStart">
         <soap:operation soapAction="http://wsdl.idt.b2bapi.net/SessionStart" style="document"/>
         <wsdl:input>
            <soap:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="B2BServiceSoap12" type="tns:B2BServiceSoap">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="GetProducts">
         <soap12:operation soapAction="http://wsdl.idt.b2bapi.net/GetProducts" style="document"/>
         <wsdl:input>
            <soap12:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap12:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
      <wsdl:operation name="SessionStart">
         <soap12:operation soapAction="http://wsdl.idt.b2bapi.net/SessionStart" style="document"/>
         <wsdl:input>
            <soap12:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap12:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="B2BService">
      <wsdl:documentation>IDT B2BService</wsdl:documentation>
      <wsdl:port name="B2BServiceSoap" binding="tns:B2BServiceSoap">
         <soap:address location="http://169.132.165.178/b2bapi/b2bservice.asmx"/>
      </wsdl:port>
      <wsdl:port name="B2BServiceSoap12" binding="tns:B2BServiceSoap12">
         <soap12:address location="http://169.132.165.178/b2bapi/b2bservice.asmx"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:24:47+00:00Added an answer on June 9, 2026 at 12:24 pm

    My guess is that SoapClient is confused because it sees elementFormDefault="qualified" but no namespace on the schema. Save the WSDL to your local machine and try making everything part of the first <xsd:schema> element in the WSDL by removing all the:

    </s:schema>
    <s:schema elementFormDefault="qualified">
    

    After that pass your local WSDL to SoapClient. The endpoint in the WSDL should be enough to tell it where to send the message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having trouble getting my JTable that im using to display either check boxes
I'm currently having trouble getting example code for using tweepy to access Twitter's Streaming
I'm having trouble getting Tire working using ElasticSearch with the Bonsai addon on the
I'm having trouble getting Japanese text to display properly on a website compiled using
I'm having trouble getting the server to recognize a JSON POST request since I
I'm having trouble getting OpenGL 3.2 to run on Lion (osx 10.7.4) using Derelict3
Having trouble getting this to work. What's strange is that I have 10 bookmarks
I'm having trouble getting Jquery .closest() to work. Here's my code, it's simple and
Having trouble getting the oauth access token and secret exchanged from the request tokens
I'm having trouble getting client validation to work on a web form. I'm including

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.