You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by rymonroe <ry...@hotmail.com> on 2013/03/15 21:27:34 UTC

Backwards compatiblity between cxf-2.7.3 and cxf-2.3.1

We have recently upgraded to cxf-2.7.3 from cxf-2.3.1. We still have a legacy
client useing 2.3.1. When they try to access our webservice, they get the
following error.

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException:
Unmarshalling Error: unexpected element
(uri:"http://server.testService.test.hp.com/", local:"test_data_model").
Expected elements are <{}arg0> 

I am unable to change anthing on the client side, only on the server side.
Below is our generated WSDL with cxf2.7.1. I have scoured google for a
solution to this question for the last couple of days and found nothing that
helps. Does anyone have any suggestions? Thanks.

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://server.testService.test.hp.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="testService"
targetNamespace="http://server.testService.test.hp.com/">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://server.testService.test.hp.com/"
elementFormDefault="unqualified"
targetNamespace="http://server.testService.test.hp.com/" version="1.0">
<xs:element name="calculateSum" type="tns:calculateSum"/>
<xs:element name="calculateSumOnTestDataModel"
type="tns:calculateSumOnTestDataModel"/>
<xs:element name="calculateSumOnTestDataModelResponse"
type="tns:calculateSumOnTestDataModelResponse"/>
<xs:element name="calculateSumResponse" type="tns:calculateSumResponse"/>
<xs:element name="test_data_model">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="processing_information"
type="tns:processing-information"/>
        <xs:element name="cte_document" type="tns:cte-document"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
<xs:complexType name="calculateSumOnTestDataModel">
    <xs:sequence>
      <xs:element minOccurs="0" name="arg0">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="processing_information"
type="tns:processing-information"/>
            <xs:element name="cte_document" type="tns:cte-document"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
<xs:complexType name="processing-information">
    <xs:sequence>
      <xs:element minOccurs="0" name="doc_num" type="xs:string"/>
      <xs:element minOccurs="0" name="doc_date" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
<xs:complexType name="cte-document">
    <xs:sequence>
      <xs:element name="number1" type="xs:string"/>
      <xs:element name="number2" type="xs:string"/>
      <xs:element minOccurs="0" name="product" type="xs:string"/>
      <xs:element minOccurs="0" name="sum" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
<xs:complexType name="calculateSumOnTestDataModelResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="return">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="processing_information"
type="tns:processing-information"/>
            <xs:element name="cte_document" type="tns:cte-document"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
<xs:complexType name="calculateSum">
    <xs:sequence>
      <xs:element minOccurs="0" name="arg0" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
<xs:complexType name="calculateSumResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="return" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="calculateSumOnTestDataModel">
    <wsdl:part element="tns:calculateSumOnTestDataModel" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="calculateSum">
    <wsdl:part element="tns:calculateSum" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="calculateSumOnTestDataModelResponse">
    <wsdl:part element="tns:calculateSumOnTestDataModelResponse"
name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="calculateSumResponse">
    <wsdl:part element="tns:calculateSumResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="TestService">
    <wsdl:operation name="calculateSumOnTestDataModel">
      <wsdl:input message="tns:calculateSumOnTestDataModel"
name="calculateSumOnTestDataModel">
    </wsdl:input>
      <wsdl:output message="tns:calculateSumOnTestDataModelResponse"
name="calculateSumOnTestDataModelResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="calculateSum">
      <wsdl:input message="tns:calculateSum" name="calculateSum">
    </wsdl:input>
      <wsdl:output message="tns:calculateSumResponse"
name="calculateSumResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="testServiceSoapBinding" type="tns:TestService">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="calculateSumOnTestDataModel">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="calculateSumOnTestDataModel">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="calculateSumOnTestDataModelResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="calculateSum">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="calculateSum">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="calculateSumResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="testService">
    <wsdl:port binding="tns:testServiceSoapBinding"
name="TestServiceImplPort">
      <soap:address
location="http://localhost:30000/testService/services/testService"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>




--
View this message in context: http://cxf.547215.n5.nabble.com/Backwards-compatiblity-between-cxf-2-7-3-and-cxf-2-3-1-tp5724643.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Backwards compatiblity between cxf-2.7.3 and cxf-2.3.1

Posted by rymonroe <ry...@hotmail.com>.
Thank you for the quick response Daniel. Here is the TestDataModel class. I
have tried to add annotations @WebParam(targetNamespace="",
name="test_data_model" to my implementation (as seen at very end) but I
still get the same error. 

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB)
Reference Implementation, vJAXB 2.1.10 in JDK 6 
// See  http://java.sun.com/xml/jaxb <http://java.sun.com/xml/jaxb>   
// Any modifications to this file will be lost upon recompilation of the
source schema. 
// Generated on: 2013.03.13 at 01:03:25 PM CDT 
//


/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained
within this class.
 * 
 * <pre>
 * &lt;complexType>
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="processing_information"
type="{}processing-information"/>
 *         &lt;element name="cte_document" type="{}cte-document"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", namespace = "", propOrder = {
    "processingInformation",
    "cteDocument"
})
@XmlRootElement(name = "test_data_model")
public class TestDataModel {

    @XmlElement(name = "processing_information", required = true)
    protected ProcessingInformation processingInformation;
    @XmlElement(name = "cte_document", required = true)
    protected CteDocument cteDocument;

    /**
     * Gets the value of the processingInformation property.
     * 
     * @return
     *     possible object is
     *     {@link ProcessingInformation }
     *     
     */
    public ProcessingInformation getProcessingInformation() {
        return processingInformation;
    }

    /**
     * Sets the value of the processingInformation property.
     * 
     * @param value
     *     allowed object is
     *     {@link ProcessingInformation }
     *     
     */
    public void setProcessingInformation(ProcessingInformation value) {
        this.processingInformation = value;
    }

    /**
     * Gets the value of the cteDocument property.
     * 
     * @return
     *     possible object is
     *     {@link CteDocument }
     *     
     */
    public CteDocument getCteDocument() {
        return cteDocument;
    }

    /**
     * Sets the value of the cteDocument property.
     * 
     * @param value
     *     allowed object is
     *     {@link CteDocument }
     *     
     */
    public void setCteDocument(CteDocument value) {
        this.cteDocument = value;
    }

}








Implementation





@WebService(endpointInterface =
"com.hp.test.testService.server.TestService", serviceName = "testService")
//@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)

public class TestServiceImpl implements TestService
{
	@Override
	public String calculateSum(String anXMLDocument) 
	{
		return TestServiceUtil.calculateSum(anXMLDocument);
	}

	@Override
	public TestDataModel
calculateSumOnTestDataModel(@WebParam(targetNamespace="",
name="test_data_model") TestDataModel aTestDataModel) 
	{
		return TestServiceUtil.calculateSumOnTestDataModel(aTestDataModel);
	}

}



--
View this message in context: http://cxf.547215.n5.nabble.com/Backwards-compatiblity-between-cxf-2-7-3-and-cxf-2-3-1-tp5724643p5724658.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Backwards compatiblity between cxf-2.7.3 and cxf-2.3.1

Posted by Daniel Kulp <dk...@apache.org>.
What annotations do you have on the object that would map to test_data_model?

It LOOKS like you have an XmlRootElement annotation on there, but no XmlType annotation (or XmlType with name="").

In addition, in your @WebParam and @WebResult annotations on your service, you would likely need to add the correct names and namespaces of the elements that are expected.  You don't seem to have them there so it's using the JAX-WS defaults of "arg0" in no namespace.

Dan



On Mar 15, 2013, at 4:27 PM, rymonroe <ry...@hotmail.com> wrote:

> We have recently upgraded to cxf-2.7.3 from cxf-2.3.1. We still have a legacy
> client useing 2.3.1. When they try to access our webservice, they get the
> following error.
> 
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException:
> Unmarshalling Error: unexpected element
> (uri:"http://server.testService.test.hp.com/", local:"test_data_model").
> Expected elements are <{}arg0> 
> 
> I am unable to change anthing on the client side, only on the server side.
> Below is our generated WSDL with cxf2.7.1. I have scoured google for a
> solution to this question for the last couple of days and found nothing that
> helps. Does anyone have any suggestions? Thanks.
> 
> <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://server.testService.test.hp.com/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="testService"
> targetNamespace="http://server.testService.test.hp.com/">
>  <wsdl:types>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http://server.testService.test.hp.com/"
> elementFormDefault="unqualified"
> targetNamespace="http://server.testService.test.hp.com/" version="1.0">
> <xs:element name="calculateSum" type="tns:calculateSum"/>
> <xs:element name="calculateSumOnTestDataModel"
> type="tns:calculateSumOnTestDataModel"/>
> <xs:element name="calculateSumOnTestDataModelResponse"
> type="tns:calculateSumOnTestDataModelResponse"/>
> <xs:element name="calculateSumResponse" type="tns:calculateSumResponse"/>
> <xs:element name="test_data_model">
>    <xs:complexType>
>      <xs:sequence>
>        <xs:element name="processing_information"
> type="tns:processing-information"/>
>        <xs:element name="cte_document" type="tns:cte-document"/>
>      </xs:sequence>
>    </xs:complexType>
>  </xs:element>
> <xs:complexType name="calculateSumOnTestDataModel">
>    <xs:sequence>
>      <xs:element minOccurs="0" name="arg0">
>        <xs:complexType>
>          <xs:sequence>
>            <xs:element name="processing_information"
> type="tns:processing-information"/>
>            <xs:element name="cte_document" type="tns:cte-document"/>
>          </xs:sequence>
>        </xs:complexType>
>      </xs:element>
>    </xs:sequence>
>  </xs:complexType>
> <xs:complexType name="processing-information">
>    <xs:sequence>
>      <xs:element minOccurs="0" name="doc_num" type="xs:string"/>
>      <xs:element minOccurs="0" name="doc_date" type="xs:string"/>
>    </xs:sequence>
>  </xs:complexType>
> <xs:complexType name="cte-document">
>    <xs:sequence>
>      <xs:element name="number1" type="xs:string"/>
>      <xs:element name="number2" type="xs:string"/>
>      <xs:element minOccurs="0" name="product" type="xs:string"/>
>      <xs:element minOccurs="0" name="sum" type="xs:string"/>
>    </xs:sequence>
>  </xs:complexType>
> <xs:complexType name="calculateSumOnTestDataModelResponse">
>    <xs:sequence>
>      <xs:element minOccurs="0" name="return">
>        <xs:complexType>
>          <xs:sequence>
>            <xs:element name="processing_information"
> type="tns:processing-information"/>
>            <xs:element name="cte_document" type="tns:cte-document"/>
>          </xs:sequence>
>        </xs:complexType>
>      </xs:element>
>    </xs:sequence>
>  </xs:complexType>
> <xs:complexType name="calculateSum">
>    <xs:sequence>
>      <xs:element minOccurs="0" name="arg0" type="xs:string"/>
>    </xs:sequence>
>  </xs:complexType>
> <xs:complexType name="calculateSumResponse">
>    <xs:sequence>
>      <xs:element minOccurs="0" name="return" type="xs:string"/>
>    </xs:sequence>
>  </xs:complexType>
> </xs:schema>
>  </wsdl:types>
>  <wsdl:message name="calculateSumOnTestDataModel">
>    <wsdl:part element="tns:calculateSumOnTestDataModel" name="parameters">
>    </wsdl:part>
>  </wsdl:message>
>  <wsdl:message name="calculateSum">
>    <wsdl:part element="tns:calculateSum" name="parameters">
>    </wsdl:part>
>  </wsdl:message>
>  <wsdl:message name="calculateSumOnTestDataModelResponse">
>    <wsdl:part element="tns:calculateSumOnTestDataModelResponse"
> name="parameters">
>    </wsdl:part>
>  </wsdl:message>
>  <wsdl:message name="calculateSumResponse">
>    <wsdl:part element="tns:calculateSumResponse" name="parameters">
>    </wsdl:part>
>  </wsdl:message>
>  <wsdl:portType name="TestService">
>    <wsdl:operation name="calculateSumOnTestDataModel">
>      <wsdl:input message="tns:calculateSumOnTestDataModel"
> name="calculateSumOnTestDataModel">
>    </wsdl:input>
>      <wsdl:output message="tns:calculateSumOnTestDataModelResponse"
> name="calculateSumOnTestDataModelResponse">
>    </wsdl:output>
>    </wsdl:operation>
>    <wsdl:operation name="calculateSum">
>      <wsdl:input message="tns:calculateSum" name="calculateSum">
>    </wsdl:input>
>      <wsdl:output message="tns:calculateSumResponse"
> name="calculateSumResponse">
>    </wsdl:output>
>    </wsdl:operation>
>  </wsdl:portType>
>  <wsdl:binding name="testServiceSoapBinding" type="tns:TestService">
>    <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>    <wsdl:operation name="calculateSumOnTestDataModel">
>      <soap:operation soapAction="" style="document"/>
>      <wsdl:input name="calculateSumOnTestDataModel">
>        <soap:body use="literal"/>
>      </wsdl:input>
>      <wsdl:output name="calculateSumOnTestDataModelResponse">
>        <soap:body use="literal"/>
>      </wsdl:output>
>    </wsdl:operation>
>    <wsdl:operation name="calculateSum">
>      <soap:operation soapAction="" style="document"/>
>      <wsdl:input name="calculateSum">
>        <soap:body use="literal"/>
>      </wsdl:input>
>      <wsdl:output name="calculateSumResponse">
>        <soap:body use="literal"/>
>      </wsdl:output>
>    </wsdl:operation>
>  </wsdl:binding>
>  <wsdl:service name="testService">
>    <wsdl:port binding="tns:testServiceSoapBinding"
> name="TestServiceImplPort">
>      <soap:address
> location="http://localhost:30000/testService/services/testService"/>
>    </wsdl:port>
>  </wsdl:service>
> </wsdl:definitions>
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Backwards-compatiblity-between-cxf-2-7-3-and-cxf-2-3-1-tp5724643.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com