Re: soapClient not creating XML request correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Naveen,
 
Thanks for the reply. I thought I don't need to use SoapParam if I use the soapClient with a WSDL, which is what I am doing. What's your thought on that? 
 
Thanks,
 
Bilig
 

________________________________
 From: NAVEEN <naveenkr2001@yahoo.com>
To: Bilig Ordos <bilig.ordos@yahoo.com>; "soap@lists.php.net" <soap@lists.php.net> 
Sent: Wednesday, August 8, 2012 2:10 AM
Subject: Re:  soapClient not creating XML request correctly
  

Hi Bilig,

Use SoapParam object to create params for soap function.
Please see php online documentation for the same.

Best,
Naveen



----- Original Message -----
From: Bilig Ordos <bilig.ordos@yahoo.com>
To: "soap@lists.php.net" <soap@lists.php.net>
Cc: 
Sent: Tuesday, 7 August 2012, 22:09
Subject: [SOAP] soapClient not creating XML request correctly

Hi,
 
 
I'm trying to work with an existing SOAP/XML web services that is working fine with clients written in Java and .Net. Any help/idea is greatly appreciated!
 
 
I need the soapClient to send the following XML request. I tested
 this request with a third-party tool and made sure it works fine:
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:con="http://www.xyz.com/product/schema/config"; xmlns:com="http://www.xyz.com/product/schema/common";>
   <soapenv:Header>
   </soapenv:Header>
   <soapenv:Body>
      <con:getConfig>
         <com:credential>
            <com:user>user</com:user>
           
 <com:password>pass</com:password>
            <!--Optional:-->
            <com:group>group</com:group>
         </com:credential>
         <!--Zero or more repetitions:-->
         <con:orderPlanFilter>
            <!--Optional:-->
            <deviceName>abc</deviceName>
         </con:orderPlanFilter>
      </con:getConfig>
   </soapenv:Body>
</soapenv:Envelope>
 
 
 
The "credential" is used for
 authentication and the "orderPanFilter" is used for filtering the data by available fields in the WS/DB.
 
My problem is that I was only able to have the soapClient send the following request:
 
<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="http://www.xyz.com/product/schema/common"; xmlns:ns2="http://www.xyz.com/product/schema/config";>
<SOAP-ENV:Body>
   <ns2:getConfig>
      <ns1:credential>
         <ns1:user>user</ns1:user>
        
 <ns1:password>pass</ns1:password>
         <ns1:group>group</ns1:group>
      </ns1:credential>
   </ns2:getConfig>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 
 
As you can see, the soapClient does not send the "orderPlanFilter" part. I tried a few variations of the code, but it basically goes like the following:
 
$op = "http location to URL";
try {
    $x = @new SoapClient($op, array('local_cert'=>file_get_contents('./client.trustore'),'passphrase'=>abcdef, 'trace
'=>1));
} catch (SoapFault $E) {
    echo $E->faultstring;
}

$results = $x->getOrderPlanConfig(array('credential'=>array('user'=>'user', 'password'=>'pass', 'group'=>'group')
, array('orderPlanFilter'=>array('deviceName'=>'abc'))));
echo
 "REQUEST:<br />" . htmlentities($x->__getLastRequest()) . "<br />";
echo "<br /><br />";
var_dump_pre($results);
echo "<br /><br />";

 
And the response I received is (line break inserted manually for convenience): 
 
REQUEST:
<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="http://www.xyz.com/product/schema/common"; xmlns:ns2="http://www.xyz.com/product/schema/config";>
<SOAP-ENV:Body>
<ns2:getConfig>
<ns1:credential>
<ns1:user>user</ns1:user>
<ns1:password>pass</ns1:password>
<ns1:group>group</ns1:group>
</ns1:credential>
</ns2:getConfig>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 
object(stdClass)#2 (3) {
  ["ok"]=>
  string(2) "ok"
  ["error"]=>
  NULL
  ["data"]=>
  NULL
}

 
I expected to receive some data based on the orderPlanFilter but since the request does not contain the "orderPlanFilter" part, I'm not getting any data back. 
 
Following is the result of "getFunctions()" and "getTypes()" from the WSDL:
 
Available Functions: 
reply editorderPlanConfig(editConfig $orderPlanConfigEditRequest)
reply getorderPlanConfig(getConfig
 $orderPlanConfigGetRequest)
 
Available Types: 
struct credentialsType { string user; string password; string group; }
string ErrorTypes
string ErrorTag
struct dataErrorInfo { short sequenceNumber; string message; }
struct errorInfoType { dataErrorInfo badAttribute; dataErrorInfo badElement; dataErrorInfo okElement; dataErrorInfo errElement; dataErrorInfo noopElement; }
string ErrorSeverity
string errorOptionType
struct errorType { ErrorTypes errorTtype; ErrorTag errorTag; ErrorSeverity errorSeverity; string erroAppTag; string errorPath; int errorNumber; string errorMessage; errorInfoType errorInfo; }
string IP
string filterType
struct filter { filterType type; positiveInteger pageIndex; positiveInteger pageSize; }
string mediaRoutingType
struct webServiceFilter { webServiceFilterType type; positiveInteger pageIndex; positiveInteger pageSize; short sequenceNumber; }
string
 webServiceFilterType
struct intFilter { intOperator operator; string value; }
string intOperator
struct dateFilter { dateOperator operator; string value; }
string dateOperator
struct dateTimeType { dateTime dummy; }
struct config { credentialsType credential; orderPlanConfigType orderPlanConfig; }
struct dataType { orderPlanConfigType orderPlanConfig; }
struct reply { string ok; errorType error; dataType data; }
struct editConfig { config config; errorOptionType errorOption; }
struct getConfig { credentialsType credential; orderPlanFilterType orderPlanFilter; }
struct orderPlanFilterType { string deviceName; string group; string planName; dateFilter created; dateFilter lastModified; }
struct orderPlanType { deviceName deviceName; group group; planName planName; dateTime created; dateTime lastModified; }
string deviceName
string group
string planName
struct orderPlanConfigType { orderPlanType orderPlan;
 orderPlanConfigCommand command; short sequenceNumber; }
string orderPlanConfigCommand
 
 
Thanks,
 
Bilig

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux