PEAR::SOAP/.NET interoperability

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

 



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

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