3 Replies Latest reply on Oct 15, 2007 4:38 AM by Johannes Testori

    soap message not correct?

    Johannes Testori Newbie

      i have an existing oracle-bpel-process that i want to call with JBossWS. so i used wsconsume to create java classes for the WSDL. but when i use the classes to call the webservice, the generated soap-message seems to be incorrect:

      <inputVariable>
       <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
       <ns1:ApproveActivityIN xmlns:ns1="http://www.example.org">
       <activityId>1684</activityId>
       <action>approve</action>
       </ns1:ApproveActivityIN>
       </part>
      </inputVariable>
      


      the namespace for activity and action are missing. in my opinion it should look like this:
      <inputVariable>
       <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
       <ns1:ApproveActivityIN xmlns:ns1="http://www.example.org">
       <ns1:activityId>1684</ns1:activityId>
       <ns1:action>approve</ns1:action>
       </ns1:ApproveActivityIN>
       </part>
      </inputVariable>
      


      here's the wsdl of my bpel-process:
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions
       name="ApproveActivity"
       targetNamespace="http://xmlns.oracle.com/ApproveActivity"
       xmlns="http://schemas.xmlsoap.org/wsdl/"
       xmlns:tns="http://xmlns.oracle.com/ApproveActivity"
       xmlns:ns1="http://www.example.org"
       xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
       xmlns:ns2="http://www.example.org"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns:client="http://xmlns.oracle.com/ApproveActivity"
       >
       <types>
       <schema xmlns="http://www.w3.org/2001/XMLSchema">
       <import namespace="http://www.example.org" schemaLocation="ApproveActivityIN.xsd"/>
       </schema>
       <schema xmlns="http://www.w3.org/2001/XMLSchema">
       <import namespace="http://www.example.org" schemaLocation="ApproveActivityOUT.xsd"/>
       </schema>
       </types>
       <message name="ApproveActivityRequestMessage">
       <part name="payload" element="ns1:ApproveActivityIN"/>
       </message>
       <message name="ApproveActivityResponseMessage">
       <part name="payload" element="ns1:ApproveActivityOUT"/>
       </message>
       <portType name="ApproveActivity">
       <operation name="process">
       <input message="tns:ApproveActivityRequestMessage"/>
       <output message="tns:ApproveActivityResponseMessage"/>
       </operation>
       </portType>
       <binding name="ApproveActivityBinding" type="tns:ApproveActivity">
       <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="process">
       <soap:operation style="document" soapAction="process"/>
       <input>
       <soap:body use="literal"/>
       </input>
       <output>
       <soap:body use="literal"/>
       </output>
       </operation>
       </binding>
       <service name="ApproveActivity">
       <port name="ApproveActivityPort" binding="tns:ApproveActivityBinding">
       <soap:address location="http://sh159:8888/orabpel/default/ApproveActivity/1.0"/>
       </port>
       </service>
       <plnk:partnerLinkType name="ApproveActivity">
       <plnk:role name="ApproveActivityProvider">
       <plnk:portType name="tns:ApproveActivity"/>
       </plnk:role>
       </plnk:partnerLinkType>
      </definitions>
      


      and the xsd for the input:
      <?xml version="1.0" encoding="windows-1252" ?>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns="http://www.example.org"
       targetNamespace="http://www.example.org"
       elementFormDefault="qualified">
       <xsd:element name="ApproveActivityIN">
       <xsd:annotation>
       <xsd:documentation>
       </xsd:documentation>
       </xsd:annotation>
       <xsd:complexType>
       <xsd:sequence>
       <xsd:element name="activityId">
       <xsd:simpleType>
       <xsd:restriction base="xsd:int">
       <xsd:minInclusive value="0"/>
       </xsd:restriction>
       </xsd:simpleType>
       </xsd:element>
       <xsd:element name="action">
       <xsd:simpleType>
       <xsd:restriction base="xsd:string">
       <xsd:enumeration value="approve"/>
       <xsd:enumeration value="reject"/>
       </xsd:restriction>
       </xsd:simpleType>
       </xsd:element>
       </xsd:sequence>
       </xsd:complexType>
       </xsd:element>
      </xsd:schema>
      


      when i use xfire/aegis to create the client classes, everything works as expected. but i would like to use JBossWS because i use JBoss AS anyway.

        • 2. Re: soap message not correct?
          Alessio Soldano Master

          Yes, the soap message payload does not match with the specified wsdl. From which version of JBossWS is the wsconsume you're using? The one that ships with the AS (thus 1.2.1.GA) ?

          • 3. Re: soap message not correct?
            Johannes Testori Newbie

            tested with 1.2.1 and 2.0.1. then i deployed jbossws-2.0.1, same problem.

            strange thing is that it works when i use the generated classes it in a simple main-class without jboss, so i guess there must be a classpath-problem. but i don't deploy any webservice-related jar-file together with my application.

            maybe the generated source code can help:

            package com.shark.ewob.services.approveactivity;
            
            import javax.jws.WebMethod;
            import javax.jws.WebParam;
            import javax.jws.WebResult;
            import javax.jws.WebService;
            import javax.jws.soap.SOAPBinding;
            
            
            /**
             * This class was generated by the JAX-WS RI.
             * JAX-WS RI 2.1.1-b03-
             * Generated source version: 2.0
             *
             */
            @WebService(name = "ApproveActivity", targetNamespace = "http://xmlns.oracle.com/ApproveActivity")
            @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
            public interface ApproveActivity {
            
            
             /**
             *
             * @param payload
             * @return
             * returns com.shark.ewob.services.approveactivity.ApproveActivityOUT
             */
             @WebMethod(action = "process")
             @WebResult(name = "ApproveActivityOUT", targetNamespace = "http://www.example.org", partName = "payload")
             public ApproveActivityOUT process(
             @WebParam(name = "ApproveActivityIN", targetNamespace = "http://www.example.org", partName = "payload")
             ApproveActivityIN payload);
            
            }
            


            
            package com.shark.ewob.services.approveactivity;
            
            import java.net.MalformedURLException;
            import java.net.URL;
            import javax.xml.namespace.QName;
            import javax.xml.ws.Service;
            import javax.xml.ws.WebEndpoint;
            import javax.xml.ws.WebServiceClient;
            
            
            /**
             * This class was generated by the JAX-WS RI.
             * JAX-WS RI 2.1.1-b03-
             * Generated source version: 2.0
             *
             */
            @WebServiceClient(name = "ApproveActivity", targetNamespace = "http://xmlns.oracle.com/ApproveActivity", wsdlLocation = "http://localhost:8888/orabpel/default/ApproveActivity/1.0/ApproveActivity?wsdl")
            public class ApproveActivity_Service
             extends Service
            {
            
             private final static URL APPROVEACTIVITY_WSDL_LOCATION;
            
             static {
             URL url = null;
             try {
             url = new URL("http://localhost:8888/orabpel/default/ApproveActivity/1.0/ApproveActivity?wsdl");
             } catch (MalformedURLException e) {
             e.printStackTrace();
             }
             APPROVEACTIVITY_WSDL_LOCATION = url;
             }
            
             public ApproveActivity_Service(URL wsdlLocation, QName serviceName) {
             super(wsdlLocation, serviceName);
             }
            
             public ApproveActivity_Service() {
             super(APPROVEACTIVITY_WSDL_LOCATION, new QName("http://xmlns.oracle.com/ApproveActivity", "ApproveActivity"));
             }
            
             /**
             *
             * @return
             * returns ApproveActivity
             */
             @WebEndpoint(name = "ApproveActivityPort")
             public ApproveActivity getApproveActivityPort() {
             return (ApproveActivity)super.getPort(new QName("http://xmlns.oracle.com/ApproveActivity", "ApproveActivityPort"), ApproveActivity.class);
             }
            
            }
            


            package com.shark.ewob.services.approveactivity;
            
            import javax.xml.bind.annotation.XmlAccessType;
            import javax.xml.bind.annotation.XmlAccessorType;
            import javax.xml.bind.annotation.XmlElement;
            import javax.xml.bind.annotation.XmlRootElement;
            import javax.xml.bind.annotation.XmlType;
            
            
            /**
             * <p>Java class for anonymous complex type.
             *
             * <p>The following schema fragment specifies the expected content contained within this class.
             *
             * <pre>
             * <complexType>
             * <complexContent>
             * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             * <sequence>
             * <element name="activityId">
             * <simpleType>
             * <restriction base="{http://www.w3.org/2001/XMLSchema}int">
             * <minInclusive value="0"/>
             * </restriction>
             * </simpleType>
             * </element>
             * <element name="action">
             * <simpleType>
             * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
             * <enumeration value="approve"/>
             * <enumeration value="reject"/>
             * </restriction>
             * </simpleType>
             * </element>
             * <element name="approverId">
             * <simpleType>
             * <restriction base="{http://www.w3.org/2001/XMLSchema}int">
             * <minExclusive value="0"/>
             * </restriction>
             * </simpleType>
             * </element>
             * <element name="comment">
             * <simpleType>
             * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
             * <maxLength value="255"/>
             * </restriction>
             * </simpleType>
             * </element>
             * </sequence>
             * </restriction>
             * </complexContent>
             * </complexType>
             * </pre>
             *
             *
             */
            @XmlAccessorType(XmlAccessType.FIELD)
            @XmlType(name = "", propOrder = {
             "activityId",
             "action",
             "approverId",
             "comment"
            })
            @XmlRootElement(name = "ApproveActivityIN")
            public class ApproveActivityIN {
            
             protected int activityId;
             @XmlElement(required = true)
             protected String action;
             protected int approverId;
             @XmlElement(required = true)
             protected String comment;
            
             /**
             * Gets the value of the activityId property.
             *
             */
             public int getActivityId() {
             return activityId;
             }
            
             /**
             * Sets the value of the activityId property.
             *
             */
             public void setActivityId(int value) {
             this.activityId = value;
             }
            
             /**
             * Gets the value of the action property.
             *
             * @return
             * possible object is
             * {@link String }
             *
             */
             public String getAction() {
             return action;
             }
            
             /**
             * Sets the value of the action property.
             *
             * @param value
             * allowed object is
             * {@link String }
             *
             */
             public void setAction(String value) {
             this.action = value;
             }
            
             /**
             * Gets the value of the approverId property.
             *
             */
             public int getApproverId() {
             return approverId;
             }
            
             /**
             * Sets the value of the approverId property.
             *
             */
             public void setApproverId(int value) {
             this.approverId = value;
             }
            
             /**
             * Gets the value of the comment property.
             *
             * @return
             * possible object is
             * {@link String }
             *
             */
             public String getComment() {
             return comment;
             }
            
             /**
             * Sets the value of the comment property.
             *
             * @param value
             * allowed object is
             * {@link String }
             *
             */
             public void setComment(String value) {
             this.comment = value;
             }
            
            }
            


            package com.shark.ewob.services.approveactivity;
            
            import javax.xml.bind.annotation.XmlAccessType;
            import javax.xml.bind.annotation.XmlAccessorType;
            import javax.xml.bind.annotation.XmlElement;
            import javax.xml.bind.annotation.XmlRootElement;
            import javax.xml.bind.annotation.XmlType;
            
            
            /**
             * <p>Java class for anonymous complex type.
             *
             * <p>The following schema fragment specifies the expected content contained within this class.
             *
             * <pre>
             * <complexType>
             * <complexContent>
             * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             * <sequence>
             * <element name="result">
             * <simpleType>
             * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
             * <enumeration value="success"/>
             * <enumeration value="error"/>
             * </restriction>
             * </simpleType>
             * </element>
             * <element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
             * </sequence>
             * </restriction>
             * </complexContent>
             * </complexType>
             * </pre>
             *
             *
             */
            @XmlAccessorType(XmlAccessType.FIELD)
            @XmlType(name = "", propOrder = {
             "result",
             "message"
            })
            @XmlRootElement(name = "ApproveActivityOUT")
            public class ApproveActivityOUT {
            
             @XmlElement(required = true)
             protected String result;
             @XmlElement(required = true, nillable = true)
             protected String message;
            
             /**
             * Gets the value of the result property.
             *
             * @return
             * possible object is
             * {@link String }
             *
             */
             public String getResult() {
             return result;
             }
            
             /**
             * Sets the value of the result property.
             *
             * @param value
             * allowed object is
             * {@link String }
             *
             */
             public void setResult(String value) {
             this.result = value;
             }
            
             /**
             * Gets the value of the message property.
             *
             * @return
             * possible object is
             * {@link String }
             *
             */
             public String getMessage() {
             return message;
             }
            
             /**
             * Sets the value of the message property.
             *
             * @param value
             * allowed object is
             * {@link String }
             *
             */
             public void setMessage(String value) {
             this.message = value;
             }
            
            }
            


            
            package com.shark.ewob.services.approveactivity;
            
            import javax.xml.bind.annotation.XmlRegistry;
            
            
            /**
             * This object contains factory methods for each
             * Java content interface and Java element interface
             * generated in the com.shark.ewob.services.approveactivity package.
             * <p>An ObjectFactory allows you to programatically
             * construct new instances of the Java representation
             * for XML content. The Java representation of XML
             * content can consist of schema derived interfaces
             * and classes representing the binding of schema
             * type definitions, element declarations and model
             * groups. Factory methods for each of these are
             * provided in this class.
             *
             */
            @XmlRegistry
            public class ObjectFactory {
            
            
             /**
             * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.shark.ewob.services.approveactivity
             *
             */
             public ObjectFactory() {
             }
            
             /**
             * Create an instance of {@link ApproveActivityOUT }
             *
             */
             public ApproveActivityOUT createApproveActivityOUT() {
             return new ApproveActivityOUT();
             }
            
             /**
             * Create an instance of {@link ApproveActivityIN }
             *
             */
             public ApproveActivityIN createApproveActivityIN() {
             return new ApproveActivityIN();
             }
            
            }