Forum Moderators: coopster

Message Too Old, No Replies

connect webservice with soap

         

jogisarge

2:24 pm on Oct 31, 2007 (gmt 0)

10+ Year Member



Hello PHP-Users,

i try to connect to a webservice but i had to send a defined xml-string.
the xml data template given to me looks so:


<?xml version="1.0" encoding="utf-8"?>
<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:Header>
<LoginControl xmlns="http://example.com/o2Web/o2Con">
<username>string</username>
<password>string</password>
</LoginControl>
</soap:Header>
<soap:Body>
<GetItemInfo xmlns="http://example.com/o2Web/o2Con">
<InItemsRows>
<InItemsRow>
<ItemID>int</ItemID>
<Quantity>double</Quantity>
</InItemsRow>
<InItemsRow>
<ItemID>int</ItemID>
<Quantity>double</Quantity>
</InItemsRow>
</InItemsRows>
</GetItemInfo>
</soap:Body>
</soap:Envelope>

I have no idea how to make the request so it lokks like the xml data above.

My 1st attempt was this:


$client = new SoapClient("https://example.com/o2Web/o2Con.asmx?WSDL",array('trace' => 1));
$parms = array('Quantity' => 5,
'ItemID' => 4757380);
$result = $client->__soapCall("GetItemInfo",$parms);

the webservice is protected by soap header.
so i have to send a header with the login data like above.

can anybody help me please
bye jogi

[edited by: dreamcatcher at 2:35 pm (utc) on Oct. 31, 2007]
[edit reason] Use example.com, thanks. [/edit]

eelixduppy

9:14 pm on Nov 6, 2007 (gmt 0)



Welcome to WebmasterWorld! Have you solved your problem yet?

I'm not too familiar with SOAP, but wouldn't you do something like this:


$client = new SoapClient("https://example.com/o2Web/o2Con.asmx?WSDL",array('trace' => 1, 'login' => "name", 'password' => "password"));