You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-user@ws.apache.org by lorkyo <lo...@163.com> on 2008/08/10 07:52:27 UTC

How to dynamicly invoke a web service?

Hello, I'm new in using wsif, can anyone give me a example  on how to invoke a webservice? the sample "DynamicInvoker" only support parts as a to be basic type, such as integer, String ansd so on. But if a part refers to a XML element listed below, How should I do? 
<xsd:element name="request" type="xsd:string"/>
    <xsd:element name="response" type="xsd:string"/>
</xsd:schema>
  </types>
  <message name="RequestMessage">
    <part name="parameters" element="tns:request"/>
  </message>
  <message name="ResponseMessage">
    <part name="parameters" element="tns:response"/>
  </message>
  <portType name="WFSPortType">
    <operation name="doservice">
      <input message="tns:RequestMessage"/>
      <output message="tns:ResponseMessage"/>
    </operation>
  </portType>
</definitions>
 
I have tried to pass String object as in put,but get a error :No such operation 'request' .  Do  I need to pass Elements as input parameters? How to generate such Elements and How to set  their values?

 
 

Re: How to dynamicly invoke a web service?

Posted by Srinivas Velidanda <sr...@gmail.com>.
Are you trying to invoke a webservice with a complex type ?

The sample xml that you have given in your query does not show any complex
type.

Assuming that you are trying to send complex type while invoking a webserve
from WSIF client, then what I can suggest you is that WSIF doesn't support
complex types, better you try Apache CXF as it is more advanced compare to
WSIF and in CXF there is support for generating the server side stubs
dynamically.

Srinivas.
On Sun, Aug 10, 2008 at 11:22 AM, lorkyo <lo...@163.com> wrote:

> Hello, I'm new in using wsif, can anyone give me a example  on how to
> invoke a webservice? the sample "DynamicInvoker" only support parts as a to
> be basic type, such as integer, String ansd so on. But if a part refers to a
> XML element listed below, How should I do?
> <xsd:element name="request" type="xsd:string"/>
>     <xsd:element name="response" type="xsd:string"/>
> </xsd:schema>
>   </types>
>   <message name="RequestMessage">
>     <part name="parameters" element="tns:request"/>
>   </message>
>   <message name="ResponseMessage">
>     <part name="parameters" element="tns:response"/>
>   </message>
>   <portType name="WFSPortType">
>     <operation name="doservice">
>       <input message="tns:RequestMessage"/>
>       <output message="tns:ResponseMessage"/>
>     </operation>
>   </portType>
> </definitions>
>
> I have tried to pass String object as in put,but get a error :No such
> operation 'request' .  Do  I need to pass Elements as input parameters? How
> to generate such Elements and How to set  their values?
>
>
>

RE: How to dynamicly invoke a web service?

Posted by Sandip Prashar <sa...@msn.com>.
Are you using Websphere provided WSIF lib, it has some comaptibility issues. Remove the dependency on the WAS WSIF lib and use the external jars from WSIF as per there doc.
 
Thanks,
 
Sandip



Date: Sun, 10 Aug 2008 14:09:22 +0800From: lorkyo@163.comTo: wsif-user@ws.apache.orgSubject: Re:How to dynamicly invoke a web service?
the "No such operation 'request' '' occured when I used the axis provider WSIFDynamicProvider_ApacheAxis(), When I use the soap provider, WSIFDynamicProvider_ApacheSOAP, it would give a error: No Serializer found to serialize a 'java.lang.String' using encoding style 'literal'.The whole WSDL is listed as below:file 1<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions name="WebFeatureService" targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance/service" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:binding="http://www.globus.org/namespaces/wfs/core/wfs_instance/bindings" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">  <wsdl:import namespace="http://www.globus.org/namespaces/wfs/core/wfs_instance/bindings" location="WFS_bindings.wsdl"/>  <wsdl:service name="WebFeatureService">    <wsdl:port name="WFSPortTypePort" binding="binding:WFSPortTypeSOAPBinding">      <soap:address location="http://localhost:8080/wsrf/services/"/>    </wsdl:port>  </wsd
 l:service></wsdl:definitions>
 
file 2:<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions name="WebFeatureService" targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance/bindings" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:porttype="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">  <wsdl:import namespace="http://www.globus.org/namespaces/wfs/core/wfs_instance" location="WFS_flattened.wsdl"/>  <wsdl:binding name="WFSPortTypeSOAPBinding" type="porttype:WFSPortType">    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>    <wsdl:operation name="doservice">      <soap:operation soapAction="http://www.globus.org/namespaces/wfs/core/wfs_instance/WFSPortType/doserviceRequest"/>      <wsdl:input>        <soap:body use="literal"/>      </wsdl:input>      <wsdl:output>        <soap:body use="literal"/>      </wsdl:output>    </wsdl:operation>  </wsdl:binding></wsdl:definitions>file 3 :<?xml version
 ="1.0" encoding="UTF-8"?><definitions name="WebFeatureService" targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsrpw="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" xmlns:wsdlpp="http://www.globus.org/namespaces/2004/10/WSDLPreprocessor" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd">  <types>    <xsd:schema targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:tns="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">        <!-- REQUESTS AND RESPONSES -->        <xsd:element name="request" type="xsd:string"/>    <xsd:element name="response" type="xsd:string"/></xsd:schema>  </types>  <mes
 sage name="RequestMessage">    <part name="parameters" element="tns:request"/>  </message>  <message name="ResponseMessage">    <part name="parameters" element="tns:response"/>  </message>  <portType name="WFSPortType">    <operation name="doservice">      <input message="tns:RequestMessage"/>      <output message="tns:ResponseMessage"/>    </operation>  </portType></definitions>.If I change the parts of third file to be :<message name="RequestMessage">    <part name="parameters" type="txsd:string"/>  </message>  <message name="ResponseMessage">    <part name="parameters" type="txsd:string"/>  </message>I got a erro: No such operation 'parameters'在2008-08-10,lorkyo <lo...@163.com> 写道:

Hello, I'm new in using wsif, can anyone give me a example  on how to invoke a webservice? the sample "DynamicInvoker" only support parts as a to be basic type, such as integer, String ansd so on. But if a part refers to a XML element listed below, How should I do? <xsd:element name="request" type="xsd:string"/>    <xsd:element name="response" type="xsd:string"/></xsd:schema>  </types>  <message name="RequestMessage">    <part name="parameters" element="tns:request"/>  </message>  <message name="ResponseMessage">    <part name="parameters" element="tns:response"/>  </message>  <portType name="WFSPortType">    <operation name="doservice">      <input message="tns:RequestMessage"/>      <output message="tns:ResponseMessage"/>    </operation>  </portType></definitions>
 I have tried to pass String object as in put,but get a error :No such operation 'request' .  Do  I need to pass Elements as input parameters? How to generate such Elements and How to set  their values?
 
 

Re:How to dynamicly invoke a web service?

Posted by lorkyo <lo...@163.com>.
the "No such operation 'request' '' occured when I used the axis provider WSIFDynamicProvider_ApacheAxis(), When I use the soap provider, WSIFDynamicProvider_ApacheSOAP, it would give a error: No Serializer found to serialize a 'java.lang.String' using encoding style 'literal'.

The whole WSDL is listed as below:
file 1
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="WebFeatureService" targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance/service" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:binding="http://www.globus.org/namespaces/wfs/core/wfs_instance/bindings" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:import namespace="http://www.globus.org/namespaces/wfs/core/wfs_instance/bindings" location="WFS_bindings.wsdl"/>
  <wsdl:service name="WebFeatureService">
    <wsdl:port name="WFSPortTypePort" binding="binding:WFSPortTypeSOAPBinding">
      <soap:address location="http://localhost:8080/wsrf/services/"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

 
file 2:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="WebFeatureService" targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance/bindings" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:porttype="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:import namespace="http://www.globus.org/namespaces/wfs/core/wfs_instance" location="WFS_flattened.wsdl"/>
  <wsdl:binding name="WFSPortTypeSOAPBinding" type="porttype:WFSPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="doservice">
      <soap:operation soapAction="http://www.globus.org/namespaces/wfs/core/wfs_instance/WFSPortType/doserviceRequest"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
</wsdl:definitions>

file 3 :
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="WebFeatureService" targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsrpw="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" xmlns:wsdlpp="http://www.globus.org/namespaces/2004/10/WSDLPreprocessor" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd">
  <types>
    <xsd:schema targetNamespace="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:tns="http://www.globus.org/namespaces/wfs/core/wfs_instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    

    <!-- REQUESTS AND RESPONSES -->
    
    <xsd:element name="request" type="xsd:string"/>
    <xsd:element name="response" type="xsd:string"/>
</xsd:schema>
  </types>
  <message name="RequestMessage">
    <part name="parameters" element="tns:request"/>
  </message>
  <message name="ResponseMessage">
    <part name="parameters" element="tns:response"/>
  </message>
  <portType name="WFSPortType">
    <operation name="doservice">
      <input message="tns:RequestMessage"/>
      <output message="tns:ResponseMessage"/>
    </operation>
  </portType>
</definitions>.

If I change the parts of third file to be :
<message name="RequestMessage">
    <part name="parameters" type="txsd:string"/>
  </message>
  <message name="ResponseMessage">
    <part name="parameters" type="txsd:string"/>
  </message>
I got a erro: No such operation 'parameters'

在2008-08-10,lorkyo <lo...@163.com> 写道:

Hello, I'm new in using wsif, can anyone give me a example  on how to invoke a webservice? the sample "DynamicInvoker" only support parts as a to be basic type, such as integer, String ansd so on. But if a part refers to a XML element listed below, How should I do? 
<xsd:element name="request" type="xsd:string"/>
    <xsd:element name="response" type="xsd:string"/>
</xsd:schema>
  </types>
  <message name="RequestMessage">
    <part name="parameters" element="tns:request"/>
  </message>
  <message name="ResponseMessage">
    <part name="parameters" element="tns:response"/>
  </message>
  <portType name="WFSPortType">
    <operation name="doservice">
      <input message="tns:RequestMessage"/>
      <output message="tns:ResponseMessage"/>
    </operation>
  </portType>
</definitions>
 
I have tried to pass String object as in put,but get a error :No such operation 'request' .  Do  I need to pass Elements as input parameters? How to generate such Elements and How to set  their values?