Re: Different SOAP Requests <soap> vs <soap-env>



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>
.



Relevant Pages

  • Problem when switching from SoapClient to WebServicesClientProtocol
    ... I have a working C# class library that acts as a soap client. ... over the formatting of the soap body: ... It all boils down to the "this.invoke" method requiring an object array ... //populate the test widgets array ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: How to do: Web Services returning a class that inherits arrayl
    ... Array types can be defined in the soap schema. ... I have a class called CartLine and I try to return this class in a Web ... The proxy reference doesn't contain any information even though I use the ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Apache Axis - Soap
    ... I have read some tutorial to Soap, but I dont get the point. ... My "simple" Problem is to turn the XML Soap Document into an Array ...
    (comp.lang.java.programmer)
  • What data types are SOAP serializable?
    ... and the syntax for converting them? ... >type ArrayList is not serializable to SOAP so it gets converted to an array ... >the array are SOAP serializable). ... >> need to be able to resize the array. ...
    (microsoft.public.dotnet.languages.csharp)
  • What data types are SOAP serializable
    ... and the syntax for converting them? ... >type ArrayList is not serializable to SOAP so it gets converted to an array ... >the array are SOAP serializable). ... >> need to be able to resize the array. ...
    (microsoft.public.dotnet.languages.csharp)