Re: Different SOAP Requests <soap> vs <soap-env>
- From: jaden10001@xxxxxxxxx
- Date: Mon, 9 Feb 2009 08:09:01 -0800 (PST)
On Feb 9, 4:13 am, Jeroen <jer...@xxxxxxxxxxxxx> wrote:
On Feb 9, 2:45 am, jaden10...@xxxxxxxxx wrote:
I'm trying to use SOAP with a defined WSDL file. But the request PHP
is sending is different then what the service is expecting. The
service is expecting tags like <soap: but PHP is sending <soap-env:
and the service is expecting params by name like <username></username>
but PHP is sending <param1>, <param2>, etc. There are examples of the
2 below. Anyone know what the issue is?
Soap Request Send By PHP
======================
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="URL REMOVED">
<SOAP-ENV:Body>
<ns1:AuthenticateUser/>
<param2>username</param2>
<param3>password</param3>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope
Soap Request Expected by Service Example
===================================
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AuthenticateUser xmlns="URL REMOVED">
<username>string</username>
<password>string</password>
</AuthenticateUser>
</soap:Body>
</soap:Envelope>
Both soap en SOAP-ENV point to the same namespace ("http://
schemas.xmlsoap.org/soap/envelope/"). As it is perfectly valid to use
any prefix, this is not the problem. The real problem probably is the
passing of named parameters. Try to pass your arguments to the
soapClient object as associative arrays, using the expected parameter
names (username, password) as keys.
HTH
Jeroen Aarts
ClickWorkshttp://www.clickworks.be- Hide quoted text -
- Show quoted text -
Thanks for the reply. Thats the thing i was passing as an associative
array. But i found that you have to use the SoapParameter objects to
get them to pass as associative tags. Like this:
$soap->AuthenticateUser(
new SoapParam($this->password, 'securityPassword'),
new SoapParam($user, 'username'),
new SoapParam($pass, 'password')
);
Except when doing this the 1st argument doesn't get sent. For some
reason the first argument is missing in the request. I think its a PHP
Soap bug as i found others with issues so you have to use the
__soapCall method instead like this:
$params = array(
new SoapParam($this->password, 'securityPassword'),
new SoapParam($user, 'username'),
new SoapParam($pass, 'password')
);
$resp = $soap->__soapCall('AuthenticateUser', $params);
The issue is that the service its being sent to doesn't like tags
prefixed with namespaces. So even though these are the same
---- Namepspace defined in root, tags are prefixed --------
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="URL REMOVED">
<SOAP-ENV:Body>
<ns1:AuthenticateUser></ns1:AuthenticateUser>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
---- Inline namepsace -------------
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="URL REMOVED">
<SOAP-ENV:Body>
<AuthenticateUser xmlns="URL REMOVED"></AuthenticateUser>
</SOAP-ENV:Body>
The service will not except the first. Do you know if there is a way
to force SOAP in PHP to place the namespaces inline without prefixing
tags?
</SOAP-ENV:Envelope>
.
- Follow-Ups:
- Re: Different SOAP Requests <soap> vs <soap-env>
- From: Owen Jacobson
- Re: Different SOAP Requests <soap> vs <soap-env>
- From: Jeroen
- Re: Different SOAP Requests <soap> vs <soap-env>
- References:
- Different SOAP Requests <soap> vs <soap-env>
- From: jaden10001
- Re: Different SOAP Requests <soap> vs <soap-env>
- From: Jeroen
- Different SOAP Requests <soap> vs <soap-env>
- Prev by Date: Re: How to detect size and resize .ico files using php
- Next by Date: Re: XML. DOM. SaveXML and empty CDATA section
- Previous by thread: Re: Different SOAP Requests <soap> vs <soap-env>
- Next by thread: Re: Different SOAP Requests <soap> vs <soap-env>
- Index(es):
Relevant Pages
|