Users - Help Using OFBiz Services with SOAP

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Users - Help Using OFBiz Services with SOAP

Vinay Agarwal

Hello,

 

I am trying to figure out how to use OFBiz services through SOAP using C# (Visual Studio 2003). Through Visual Studio I can “view” sayHello service on Si’s server at this URL (thanks Si)

            https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService/sayHello?WSDL

Visual Studio let’s me add reference to it and even generates wsdl and an XML file which are shown below. But then I get this error:

Web References\com.opensourcestrategies.demo\Reference.map: Custom tool error: Unable to import WebService/Schema. Unable to import binding 'sayHelloSoapBinding' from namespace 'http://www.ofbiz.org/service/'. Unable to import operation 'sayHello'. Specified cast is not valid.

I understand that Visual Studio is probably not used much around here, but any guidance would be very helpful. Thanks in advance.

 

Regards,

Vinay Agarwal

 

sayHello.wsdl

<?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="http://www.ofbiz.org/service/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.ofbiz.org/service/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:types />

  <wsdl:message name="sayHelloResponse">

    <wsdl:part name="resp" type="s:string" />

  </wsdl:message>

  <wsdl:message name="sayHelloRequest">

    <wsdl:part name="message" type="s:string" />

  </wsdl:message>

  <wsdl:portType name="sayHelloPortType">

    <wsdl:operation name="sayHello">

      <wsdl:input message="tns:sayHelloRequest" />

      <wsdl:output message="tns:sayHelloResponse" />

    </wsdl:operation>

  </wsdl:portType>

  <wsdl:binding name="sayHelloSoapBinding" type="tns:sayHelloPortType">

    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />

    <wsdl:operation name="sayHello">

      <soap:operation soapAction="" />

      <wsdl:input>

        <soap:body use="literal" namespace="http://www.ofbiz.org/service/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

      </wsdl:input>

      <wsdl:output>

        <soap:body use="literal" namespace="http://www.ofbiz.org/service/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:service name="sayHello">

    <wsdl:port name="sayHelloPort" binding="tns:sayHelloSoapBinding">

      <soap:address location="https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService" />

    </wsdl:port>

  </wsdl:service>

</wsdl:definitions>

 

Referece.map

<?xml version="1.0" encoding="utf-8"?>

<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <Results>

    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService/sayHello?WSDL" filename="sayHello.wsdl" />

  </Results>

</DiscoveryClientResultsFile>


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Help Using OFBiz Services with SOAP

Vinay Agarwal

I tried to import another service into Visual Studio 2003 and it works just fine. The difference in the wdsl are very minor. I don’t know what OFBiz service makes Visual Studio unhappy. The main differences I noticed is that soap binding transport style=”rpc” in temperature case (working) and style=”document” in OFBiz case (not working).

 

Regards,

Vinay Agarwal

 

Here are the details for the temp service;

Url:   http://www.xmethods.com/sd/2001/TemperatureService.wsdl

 TemperatureService.wsdl

<?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="http://www.xmethods.net/sd/TemperatureService.wsdl" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.xmethods.net/sd/TemperatureService.wsdl" name="TemperatureService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:types />

  <wsdl:message name="getTempRequest">

    <wsdl:part name="zipcode" type="s:string" />

  </wsdl:message>

  <wsdl:message name="getTempResponse">

    <wsdl:part name="return" type="s:float" />

  </wsdl:message>

  <wsdl:portType name="TemperaturePortType">

    <wsdl:operation name="getTemp">

      <wsdl:input message="tns:getTempRequest" />

      <wsdl:output message="tns:getTempResponse" />

    </wsdl:operation>

  </wsdl:portType>

  <wsdl:binding name="TemperatureBinding" type="tns:TemperaturePortType">

    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />

    <wsdl:operation name="getTemp">

      <soap:operation soapAction="" />

      <wsdl:input>

        <soap:body use="encoded" namespace="urn:xmethods-Temperature" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

      </wsdl:input>

      <wsdl:output>

        <soap:body use="encoded" namespace="urn:xmethods-Temperature" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:service name="TemperatureService">

    <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Returns current temperature in a given U.S. zipcode  </documentation>

    <wsdl:port name="TemperaturePort" binding="tns:TemperatureBinding">

      <soap:address location="http://services.xmethods.net:80/soap/servlet/rpcrouter" />

    </wsdl:port>

  </wsdl:service>

</wsdl:definitions>

Reference.map

<?xml version="1.0" encoding="utf-8"?>

<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <Results>

    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://www.xmethods.com/sd/2001/TemperatureService.wsdl" filename="TemperatureService.wsdl" />

  </Results>

</DiscoveryClientResultsFile>

Auto generated code to access the service (C#)

//------------------------------------------------------------------------------

// <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.2_32.

//

namespace WebServiceConsumer1.com.xmethods.www {

    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="TemperatureBinding", Namespace="http://www.xmethods.net/sd/TemperatureService.wsdl")]

    public class TemperatureService : System.Web.Services.Protocols.SoapHttpClientProtocol {

        

        /// <remarks/>

        public TemperatureService() {

            this.Url = "http://services.xmethods.net:80/soap/servlet/rpcrouter";

        }

        

        /// <remarks/>

        [System.Web.Services.Protocols.SoapRpcMethodAttribute("", RequestNamespace="urn:xmethods-Temperature", ResponseNamespace="urn:xmethods-Temperature")]

        [return: System.Xml.Serialization.SoapElementAttribute("return")]

        public System.Single getTemp(string zipcode) {

            object[] results = this.Invoke("getTemp", new object[] {

                        zipcode});

            return ((System.Single)(results[0]));

        }

        

        /// <remarks/>

        public System.IAsyncResult BegingetTemp(string zipcode, System.AsyncCallback callback, object asyncState) {

            return this.BeginInvoke("getTemp", new object[] {

                        zipcode}, callback, asyncState);

        }

        

        /// <remarks/>

        public System.Single EndgetTemp(System.IAsyncResult asyncResult) {

            object[] results = this.EndInvoke(asyncResult);

            return ((System.Single)(results[0]));

        }

    }

}

 

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Vinay Agarwal
Sent: Wednesday, March 22, 2006 9:03 AM
To: 'OFBiz Users / Usage Discussion'
Subject: [OFBiz] Users - Help Using OFBiz Services with SOAP

 

Hello,

 

I am trying to figure out how to use OFBiz services through SOAP using C# (Visual Studio 2003). Through Visual Studio I can “view” sayHello service on Si’s server at this URL (thanks Si)

            https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService/sayHello?WSDL

Visual Studio let’s me add reference to it and even generates wsdl and an XML file which are shown below. But then I get this error:

Web References\com.opensourcestrategies.demo\Reference.map: Custom tool error: Unable to import WebService/Schema. Unable to import binding 'sayHelloSoapBinding' from namespace 'http://www.ofbiz.org/service/'. Unable to import operation 'sayHello'. Specified cast is not valid.

I understand that Visual Studio is probably not used much around here, but any guidance would be very helpful. Thanks in advance.

 

Regards,

Vinay Agarwal

 

sayHello.wsdl

<?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="http://www.ofbiz.org/service/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://www.ofbiz.org/service/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:types />

  <wsdl:message name="sayHelloResponse">

    <wsdl:part name="resp" type="s:string" />

  </wsdl:message>

  <wsdl:message name="sayHelloRequest">

    <wsdl:part name="message" type="s:string" />

  </wsdl:message>

  <wsdl:portType name="sayHelloPortType">

    <wsdl:operation name="sayHello">

      <wsdl:input message="tns:sayHelloRequest" />

      <wsdl:output message="tns:sayHelloResponse" />

    </wsdl:operation>

  </wsdl:portType>

  <wsdl:binding name="sayHelloSoapBinding" type="tns:sayHelloPortType">

    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />

    <wsdl:operation name="sayHello">

      <soap:operation soapAction="" />

      <wsdl:input>

        <soap:body use="literal" namespace="http://www.ofbiz.org/service/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

      </wsdl:input>

      <wsdl:output>

        <soap:body use="literal" namespace="http://www.ofbiz.org/service/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />

      </wsdl:output>

    </wsdl:operation>

  </wsdl:binding>

  <wsdl:service name="sayHello">

    <wsdl:port name="sayHelloPort" binding="tns:sayHelloSoapBinding">

      <soap:address location="https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService" />

    </wsdl:port>

  </wsdl:service>

</wsdl:definitions>

 

Referece.map

<?xml version="1.0" encoding="utf-8"?>

<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <Results>

    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService/sayHello?WSDL" filename="sayHello.wsdl" />

  </Results>

</DiscoveryClientResultsFile>


 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Help Using OFBiz Services with SOAP

Vinay Agarwal
In reply to this post by Vinay Agarwal
I tried to import another service into Visual Studio 2003 and it works just
fine. The difference in the wdsl are very minor. I don’t know what OFBiz
service makes Visual Studio unhappy. The main differences I noticed is that
soap binding transport style=”rpc” in temperature case (working) and
style=”document” in OFBiz case (not working).
 
Regards,
Vinay Agarwal
 
Here are the details for the temp service;
Url:   http://www.xmethods.com/sd/2001/TemperatureService.wsdl
 TemperatureService.wsdl
<?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="http://www.xmethods.net/sd/TemperatureService.wsdl"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://www.xmethods.net/sd/TemperatureService.wsdl"
name="TemperatureService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types />
  <wsdl:message name="getTempRequest">
    <wsdl:part name="zipcode" type="s:string" />
  </wsdl:message>
  <wsdl:message name="getTempResponse">
    <wsdl:part name="return" type="s:float" />
  </wsdl:message>
  <wsdl:portType name="TemperaturePortType">
    <wsdl:operation name="getTemp">
      <wsdl:input message="tns:getTempRequest" />
      <wsdl:output message="tns:getTempResponse" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="TemperatureBinding" type="tns:TemperaturePortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
    <wsdl:operation name="getTemp">
      <soap:operation soapAction="" />
      <wsdl:input>
        <soap:body use="encoded" namespace="urn:xmethods-Temperature"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" namespace="urn:xmethods-Temperature"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="TemperatureService">
    <documentation xmlns="http://schemas.xmlsoap.org/wsdl/">Returns current
temperature in a given U.S. zipcode  </documentation>
    <wsdl:port name="TemperaturePort" binding="tns:TemperatureBinding">
      <soap:address
location="http://services.xmethods.net:80/soap/servlet/rpcrouter" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
Reference.map
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Results>
    <DiscoveryClientResult
referenceType="System.Web.Services.Discovery.ContractReference"
url="http://www.xmethods.com/sd/2001/TemperatureService.wsdl"
filename="TemperatureService.wsdl" />
  </Results>
</DiscoveryClientResultsFile>
Auto generated code to access the service (C#)
//--------------------------------------------------------------------------
----
// <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.2_32.
//
namespace WebServiceConsumer1.com.xmethods.www {
    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="TemperatureBinding
", Namespace="http://www.xmethods.net/sd/TemperatureService.wsdl")]
    public class TemperatureService :
System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        /// <remarks/>
        public TemperatureService() {
            this.Url =
"http://services.xmethods.net:80/soap/servlet/rpcrouter";
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapRpcMethodAttribute("",
RequestNamespace="urn:xmethods-Temperature",
ResponseNamespace="urn:xmethods-Temperature")]
        [return: System.Xml.Serialization.SoapElementAttribute("return")]
        public System.Single getTemp(string zipcode) {
            object[] results = this.Invoke("getTemp", new object[] {
                        zipcode});
            return ((System.Single)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BegingetTemp(string zipcode,
System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("getTemp", new object[] {
                        zipcode}, callback, asyncState);
        }
        
        /// <remarks/>
        public System.Single EndgetTemp(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((System.Single)(results[0]));
        }
    }
}
 
 
-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
On Behalf Of Vinay Agarwal
Sent: Wednesday, March 22, 2006 9:03 AM
To: 'OFBiz Users / Usage Discussion'
Subject: [OFBiz] Users - Help Using OFBiz Services with SOAP
 
Hello,
 
I am trying to figure out how to use OFBiz services through SOAP using C#
(Visual Studio 2003). Through Visual Studio I can “view” sayHello service on
Si’s server at this URL (thanks Si)
           
https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService/sayH
ello?WSDL
Visual Studio let’s me add reference to it and even generates wsdl and an
XML file which are shown below. But then I get this error:
Web References\com.opensourcestrategies.demo\Reference.map: Custom tool
error: Unable to import WebService/Schema. Unable to import binding
'sayHelloSoapBinding' from namespace 'http://www.ofbiz.org/service/'. Unable
to import operation 'sayHello'. Specified cast is not valid.
I understand that Visual Studio is probably not used much around here, but
any guidance would be very helpful. Thanks in advance.
 
Regards,
Vinay Agarwal
 
sayHello.wsdl
<?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="http://www.ofbiz.org/service/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://www.ofbiz.org/service/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types />
  <wsdl:message name="sayHelloResponse">
    <wsdl:part name="resp" type="s:string" />
  </wsdl:message>
  <wsdl:message name="sayHelloRequest">
    <wsdl:part name="message" type="s:string" />
  </wsdl:message>
  <wsdl:portType name="sayHelloPortType">
    <wsdl:operation name="sayHello">
      <wsdl:input message="tns:sayHelloRequest" />
      <wsdl:output message="tns:sayHelloResponse" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="sayHelloSoapBinding" type="tns:sayHelloPortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
    <wsdl:operation name="sayHello">
      <soap:operation soapAction="" />
      <wsdl:input>
        <soap:body use="literal" namespace="http://www.ofbiz.org/service/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" namespace="http://www.ofbiz.org/service/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="sayHello">
    <wsdl:port name="sayHelloPort" binding="tns:sayHelloSoapBinding">
      <soap:address
location="https://demo.opensourcestrategies.com:8446/webtools/control/SOAPSe
rvice" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
 
Referece.map
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Results>
    <DiscoveryClientResult
referenceType="System.Web.Services.Discovery.ContractReference"
url="https://demo.opensourcestrategies.com:8446/webtools/control/SOAPService
/sayHello?WSDL" filename="sayHello.wsdl" />
  </Results>
</DiscoveryClientResultsFile>
 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users