TheObserver
Programmer
I need to connect via SOAP to a data provider. They require several pieces of information to authenticate against. The prescribe a header layout to facilitate this:
I have attempted to connect via NuSOAP with the following:
I always get the following result for this code:
soapenv:Server: SOAPEnvelope must contain a body element which is either first or second child element of the SOAPEnvelope.
result: Array ( [faultcode] => soapenv:Server [faultstring] => unknown [detail] => )
If I go with the built in SoapClient capability with the following code:
With this code I always get the following result:
Caught exception: SOAP-ERROR: Parsing Schema: unexpected <sequence> in element
I have no control over the server and am only writing a client to connect up to it and pull some data. What am I doing wrong? This is driving me crazy!
Thanks for your time.
Code:
<soap:Header>
<impl:email>test@mountainnews.com</impl:email>
<impl:language>en</impl:language>
<impl:metric>imp</impl:metric>
<impl:token/>
<impl:password>mypassword</impl:password>
<impl:domain/>
</soap:Header>
Code:
$client = new nusoap_client($this->wsdl_location, true);
$headers = "
<soap:Header>
<impl:email>".$myUserName."</impl:email>
<impl:language>en-us</impl:language>
<impl:metric>imp</impl:metric>
<impl:token/>
<impl:password>".$myPassWord."</impl:password>
<impl:domain/>
</soap:Header>";
$client->setHeaders($headers);
$client->call("getTokens");
soapenv:Server: SOAPEnvelope must contain a body element which is either first or second child element of the SOAPEnvelope.
result: Array ( [faultcode] => soapenv:Server [faultstring] => unknown [detail] => )
If I go with the built in SoapClient capability with the following code:
Code:
$client = new SoapClient($this->wsdl_location,
array('email' => $myUserName,
'password' => $myPassWord,
'metric' => 'imp',
'language' => 'en-us',
'domain' => '',
'token' => ''));
$client->__call("getTokens");
Caught exception: SOAP-ERROR: Parsing Schema: unexpected <sequence> in element
I have no control over the server and am only writing a client to connect up to it and pull some data. What am I doing wrong? This is driving me crazy!
Thanks for your time.