Page 1 of 1

Connecting Webservice per SOAP

Posted: Wed Oct 31, 2007 9:01 am
by jogisarge
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


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:
[syntax="xml"]
<?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://server.de/o2Web/o2Con">
      <username>string</username>
      <password>string</password>
    </LoginControl>
  </soap:Header>
  <soap:Body>
    <GetItemInfo xmlns="http://server.de/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:[/syntax]

Code: Select all

$client = new SoapClient("https://server.de/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


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]