PHP SOAP Client/ ASP.NET Web Service

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

 



Hi there,

I'm trying to use PHP 5's SOAP functions to access a .NET web service. The .NET 
web service is on a machine inside my network, and is currently very simple - 
you pass it a string, and it returns "Hello <string value> there.".

The problem is that I'm unable to successfully pass the web service this string 
using PHP - it always returns the string "Hello there". Here is the code:

$param = array("Name" => "Matt!");

$client = new SoapClient(null, array
( 'location'=> "http://172.18.1.73/WSMatt2/Service1.asmx";,
                                     'uri'      => " http://tempuri.org/";,
                                     'style'    => 'document',
                                     'use'      => 'literal'));


$result = $client->__call(      "HelloGuy",      $param,
      array(
          "namespace" => "http://tempuri.org/";,
         "soapaction" => "http://tempuri.org/HelloGuy";,
         "style" => "document",
          "use" => "literal", "trace"=>"1"
       ));

print $result;


And here is the packet it sends:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1=" http://tempuri.org/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-
ENC="http://schemas.xmlsoap.org/soap/encoding/"; SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";><SOAP-
ENV:Body><ns1:HelloGuy><param0 xsi:type="xsd:string">Matt!
</param0></ns1:HelloGuy></SOAP-ENV:Body></SOAP-ENV:Envelope>

I've tried it with using the WSDL file as well, whih produces similar results - 
the only difference is that it won't pass the first element of the param array -
 I have to put two elements into the param array, which makes the packet sent 
look like the one above except it has param1 instead of param0.

Any ideas? I've looked everywhere on the web and in this list's archives, and 
tried all of the relevant examples, but nothing seems to work! This is very 
frustrating!

Regards,

Matt


------------------------------------------------------------
This email was sent from Netspace Webmail: http://www.netspace.net.au

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