RE: Web service with several operations : only the first one works

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

 



On Thu, 09 Jun 2005 14:21:38 +0200, LEBUR Guillaume wrote:

> 
> Michael> I can't switch to RPC/encoded since the web service will also
> have to be reached in MS InfoPath forms. Such forms (as well as any DotNet
> SOAP client, I think) only accept doc/lit style responses.
> 
This is not correct. The preferred way in .NET is doc/literal but this
does not in any way mean that it cannot do rpc/encoded. I have made
several client/servers using rpc/encoded which runs without any problems
under .NET.

A very brief helloworld example client in C# connecting to a PHP server
using rpc/encoded:

//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2032
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by Microsoft.VSDesigner, Version 1.1.4322.2032.
// 
namespace WindowsApplication1.WebReference {
    using System.Diagnostics;
    using System.Xml.Serialization;
    using System;
    using System.Web.Services.Protocols;
    using System.ComponentModel;
    using System.Web.Services;
    
    
    /// <remarks/>
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="BasicHelloServerBinding", Namespace="urn:BasicHelloServer")]
    public class BasicHelloServerService : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        /// <remarks/>
        public BasicHelloServerService() {
            this.Url = "http://192.168.2.96/~mir/soap/day8/BasicServer.php";;
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("BasicHelloServer#helloserver#sayhello", RequestNamespace="BasicHelloServer", ResponseNamespace="BasicHelloServer")]
        [return: System.Xml.Serialization.SoapElementAttribute("outmessage")]
        public string sayhello(string inmessage) {
            object[] results = this.Invoke("sayhello", new object[] {
                        inmessage});
            return ((string)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult Beginsayhello(string inmessage, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("sayhello", new object[] {
                        inmessage}, callback, asyncState);
        }
        
        /// <remarks/>
        public string Endsayhello(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((string)(results[0]));
        }
    }
}

The automatic generated wsdl (with wsdl.exe):
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:s="http://www.w3.org/2001/XMLSchema"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:tns="urn:BasicHelloServer" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; targetNamespace="urn:BasicHelloServer" name="BasicHelloServer" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
  <wsdl:types />
  <wsdl:message name="sayhelloRequest">
    <wsdl:part name="inmessage" type="s:string" />
  </wsdl:message>
  <wsdl:message name="sayhelloResponse">
    <wsdl:part name="outmessage" type="s:string" />
  </wsdl:message>
  <wsdl:portType name="BasicHelloServerPort">
    <wsdl:operation name="sayhello">
      <wsdl:input message="tns:sayhelloRequest" />
      <wsdl:output message="tns:sayhelloResponse" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="BasicHelloServerBinding" type="tns:BasicHelloServerPort">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; style="rpc" />
    <wsdl:operation name="sayhello">
      <soap:operation soapAction="BasicHelloServer#helloserver#sayhello" />
      <wsdl:input>
        <soap:body use="encoded" namespace="BasicHelloServer" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="BasicHelloServer" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="BasicHelloServerService">
    <documentation xmlns="http://schemas.xmlsoap.org/wsdl/";>This service returns Hello &lt;name&gt;</documentation>
    <wsdl:port name="BasicHelloServerPort" binding="tns:BasicHelloServerBinding">
      <soap:address location="http://192.168.2.96/~mir/soap/day8/BasicServer.php"; />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
-- 
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=get&search=0xE3E80917

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