0 Replies Latest reply on May 20, 2007 4:42 PM by zauberlehrling

    BPEL: invoke a oneway webservice

    zauberlehrling

      Hi,

      I have a simple oneway webservice implemented by a stateless session bean:

      package beispiel;
      
      import javax.ejb.Stateless;
      import javax.jws.Oneway;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      
      @WebService
      @Stateless
      public class Asynchron {
      
       @WebMethod
       @Oneway
       public void createAccount( String name ) {
       System.out.println("Asynchron: "+name);
       }
      }
      

      After deployment I can find the following wsdl file:
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions name="AsynchronService"
       targetNamespace="http://beispiel/"
       xmlns:tns="http://beispiel/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns="http://schemas.xmlsoap.org/wsdl/">
       <types>
       <xs:schema targetNamespace="http://beispiel/"
       version="1.0" xmlns:tns="http://beispiel/"
       xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="createAccount" type="tns:createAccount" />
       <xs:complexType name="createAccount">
       <xs:sequence>
       <xs:element minOccurs="0" name="arg0"
       type="xs:string" />
       </xs:sequence>
       </xs:complexType>
       </xs:schema>
       </types>
       <message name="Asynchron_createAccount">
       <part name="createAccount" element="tns:createAccount" />
       </message>
       <portType name="Asynchron">
       <operation name="createAccount">
       <input message="tns:Asynchron_createAccount" />
       </operation>
       </portType>
       <binding name="AsynchronBinding" type="tns:Asynchron">
       <soap:binding style="document"
       transport="http://schemas.xmlsoap.org/soap/http" />
       <operation name="createAccount">
       <soap:operation soapAction="" />
       <input>
       <soap:body use="literal" />
       </input>
       </operation>
       </binding>
       <service name="AsynchronService">
       <port name="AsynchronPort" binding="tns:AsynchronBinding">
       <soap:address
       location="http://localhost:8080/Beispiel/Asynchron" />
       </port>
       </service>
      </definitions>

      And I want to call this webservice from my bpel process:
       <bpws:variables>
       <bpws:variable messageType="ns0:PojoService_sayHello"
       name="PartnerLinkRequest" />
       <bpws:variable messageType="ns0:PojoService_sayHelloResponse"
       name="PartnerLinkResponse" />
       <bpws:variable messageType="ns0:Asynchron_createAccount"
       name="Request" />
       </bpws:variables>
       ........
       <bpws:assign name="Asyn" validate="no">
       <bpws:copy>
       <bpws:from><![CDATA['Hallo Welt!']]></bpws:from>
       <bpws:to part="createAccount" variable="Request" />
       </bpws:copy>
       </bpws:assign>
       <bpws:invoke inputVariable="Request"
       name="Invoke"
       operation="createAccount"
       partnerLink="Asynchron"
       portType="ns0:Asynchron" />
      

      with
      <plnk:partnerLinkType name="ASYNCHRONPLT">
       <plnk:role name="role4" portType="wsdl:Asynchron" />
       </plnk:partnerLinkType>
      

      If I start the bpel process, the oneway webservice Asynchron is contacted, but the webservices receives only null and JBoss reports an error:
      22:26:41,893 INFO [STDOUT] Asynchron: null
      22:26:41,903 ERROR [STDERR] [Fatal Error] :-1:-1: Premature end of file.

      I recorded the bytes send to the application server with the TCP/IP-Monitor:
      POST /Beispiel/Asynchron?datatype=SOAPMessage HTTP/1.1
      SOAPAction: ""
      Content-Type: text/xml; charset=UTF-8
      User-Agent: Java/1.5.0_10
      Host: localhost:8000
      Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
      Connection: keep-alive
      Content-Length: 239
      
      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
       <env:Header>
       </env:Header>
       <env:Body>
       <defaultNS:createAccount
       xmlns:defaultNS='http://beispiel/'>
       Hallo Welt!
       </defaultNS:createAccount>
       </env:Body>
      </env:Envelope>
      

      Is there an error in this?

      Furthermore I recorded the text send to the application server, when I call the webservice with the webservice explorer:
      POST /Beispiel/Asynchron HTTP/1.1
       Host: localhost:8000
       Content-Type: text/xml; charset=utf-8
       Content-Length: 325
       Accept: application/soap+xml, application/dime, multipart/related, text/*
       User-Agent: IBM Web Services Explorer
       Cache-Control: no-cache
       Pragma: no-cache
       SOAPAction: ""
       Connection: close
      <soapenv:Envelope
       xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:q0="http://beispiel/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soapenv:Body>
       <q0:createAccount>
       <arg0>Hallo Welt!</arg0>
       </q0:createAccount>
       </soapenv:Body>
      </soapenv:Envelope>

      I get the correct parameter in the jboss log: Hallo Welt!
      22:34:55,136 INFO [STDOUT] Asynchron.: Hallo Welt!


      My question: Is it not possible to transfer parameters to a oneway webservice?

      Best regards,

      Frank