Re: Prefixing arguments with namespaces (without WSDL)

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

 



This worked great. Thanks for the tip.

David

"Dmitri Vinogradov" <dimitri@vinogradov.de> wrote in message
20031218002830.43906.qmail@pb1.pair.com">news:20031218002830.43906.qmail@pb1.pair.com...
> Hi
>
> Please try following:
>
> $client = new
>
SOAP_Client('http://www.abundanttech.com/webservices/deadoralive/deadoralive
> .asmx');
> $options = array(
>     'namespace' =>'http://www.abundanttech.com/webservices/deadoralive',
>     'SOAPAction' =>
> 'http://www.abundanttech.com/webservices/deadoralive/getDeadOrAlive'
> );
> $args = array(
>     'sFullName' => new
>
SOAP_Value('{http://www.abundanttech.com/webservices/deadoralive}sFullName',
> 'string','Lorne Greene')
> );
> $ret = $client->call('getDeadOrAlive', $args, $options);
>
> Well...   if you use none WSDL based code you've got to play around with
> SOAP_Values  in outgoing messages ( Some kind of Low-level API...)
>
> Regards
>
> Dmitri
>
>
> "David Sklar" <tech-php@sklar.com> schrieb im Newsbeitrag
> 20031217185121.13913.qmail@pb1.pair.com">news:20031217185121.13913.qmail@pb1.pair.com...
> > I am using PEAR SOAP 0.8RC2.
> >
> > The following WSDL-based code works great (I get a response from the
> server
> > indicating that yes, Lorne Greene is dead.)
> >
> > $wsdl = new
> >
>
SOAP_WSDL('http://www.abundanttech.com/webservices/deadoralive/deadoralive.w
> > sdl');
> > $client = $wsdl->getProxy();
> > $ret = $client->getDeadOrAlive('Lorne Greene');
> >
> > The following non-WSDL-based code doesn't work (I get back an empty
> > envelope)
> >
> > $client = new
> >
>
SOAP_Client('http://www.abundanttech.com/webservices/deadoralive/deadoralive
> > .asmx');
> > $options = array('namespace' =>
> > 'http://www.abundanttech.com/webservices/deadoralive',
> >                  'soapaction' =>
> > 'http://www.abundanttech.com/webservices/deadoralive/getDeadOrAlive');
> > $args = array('sFullName' => 'Lorne Greene');
> > $ret = $client->call('getDeadOrAlive', $args, $options);
> >
> > Both the WSDL and non-WSDL versions include the app-specific namespace
in
> > the envelope with an attribute like this:
> >
> >  xmlns:ns4="http://www.abundanttech.com/webservices/deadoralive";
> >
> > inside the <SOAP-ENV:Envelope> tag.
> >
> > The crucial difference seems to be that the WSDL version correctly
> includes
> > a namespace for the argument to the method, while the non-WSDL version
> > doesn't. The WSDL version sends this as the body of the envelope:
> >
> > <SOAP-ENV:Body>
> > <ns4:getDeadOrAlive>
> > <ns4:sFullName>Lorne Greene</ns4:sFullName></ns4:getDeadOrAlive>
> > </SOAP-ENV:Body>
> >
> > The non-WSDL version sends this body:
> >
> > <SOAP-ENV:Body>
> > <ns4:getDeadOrAlive>
> > <sFullName xsi:type="xsd:string">Lorne
> > Greene</sFullName></ns4:getDeadOrAlive>
> > </SOAP-ENV:Body>
> >
> > If I specify "ns4:sFullName" as the name of the argument instead of just
> > "sFullName" in the non-WSDL version, then I get back a successful
response
> > just like in the WSDL version. But I only know that ns4 is the right
> > namespace from examining the wire output from unsucessful requests, so
> this
> > isn't really a scalable or pretty way to do it.
> >
> > In circumstances where I can't use WSDL, how can I make sure that the
> > correct namespace prefix is prepended to my argument names?
> >
> > Thanks,
> > David

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