Re: PEAR::SOAP/.NET interoperability
| From: | Manuel V�zquez Acosta | Date: | Sat, 01 Nov 2003 20:33:17 +0000 |
| Subject: | Re: PEAR::SOAP/.NET interoperability | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-1139@lists.php.net to get a copy of this message | ||
Humm!
I think you should try changing:
style" => "document",
to
style" => "rpc",
Manu.
"Christian Wenz" <christian@wenz.org> wrote in message
news:3F80517B.4B2E807B@wenz.org...
> Hi guys,
>
> today I tried to connect to a .NET web service _without_ using the WSDL
> functionality of PEAR::SOAP. However unfortunately, my script does not
> work as expected. I am quite sure that there is something obvious I am
> doing wrong, but I cannot spot it. I hope you can :-)
>
> So here is the .NET web service:
>
> <%@ WebService language="C#" class="WS" %>
>
> using System;
> using System.Web.Services;
> using System.Xml.Serialization;
>
> public class WS {
> [WebMethod]
> public string Echo(string s) {
> return s;
> }
> }
>
> (a very simple "echo" web service, string parameter called s, web method
> called "Echo", since no namespace is set,
> http://tempuri.org/ is used as
> namespace, http://tempuri.org/Echo is the SOAPAction.
>
> Now here is what I do with PHP (tried with PEAR::SOAP 0.8RC2 and 0.7.5)
>
> --SNIP---
> <?php
> require_once "SOAP/Client.php";
>
> $soap = new
>
> SOAP_Client("http://www.hauser-wenz.net/playground/ws/Echo.asmx");
>
> $param = array("s" => "Hello!");
> $result = $soap->call(
> "Echo",
> $param,
> array(
> "namespace" =>
> "http://tempuri.org/",
> "soapaction" =>
> "http://tempuri.org/Echo",
> "style" => "document",
> "use" => "literal", "trace"=>"1"
> ));
> if (strtolower(get_class($result)) == "soap_fault") {
> print "Error! " . $result->message;
> } else {
> print "{".$result."}";
> }
> print "<hr />Debug<pre>";
> print nl2br(htmlspecialchars($soap->__getlastrequest()));
> print "</pre>";
> print "<hr /><pre>";
> print nl2br(htmlspecialchars($soap->__getlastresponse()));
> print "</pre>";
> ?>
> --SNIP---
>
>
> First thing I noticed is that the "s" parameter is encoded like this:
> <s>Hello!</s>
> however I'd expect
> <Echo
> xmlns="http://tempuri.org/"><s>Hello!"</s></Echo>
>
> Consequence: The .NET web method does not receive a parameter and
> returns an empty string.
>
>
> Any ideas what could be wrong or what I am missing? You can run the .NET
> web service at
> http://www.hauser-wenz.net/playground/ws/Echo.asmx .
>
> Regards
> Christian