Data binding does not work when Java interface & implementation (where method
param is not String, primitive) exposed with a web services binding
--------------------------------------------------------------------------------------------------------------------------------------------------
Key: TUSCANY-2388
URL: https://issues.apache.org/jira/browse/TUSCANY-2388
Project: Tuscany
Issue Type: Bug
Components: Java SCA Data Binding Runtime
Affects Versions: Java-SCA-1.1
Environment: Windows XP; IBM J2RE 1.5.0 (Build 2.3)
Reporter: Peter Kemp
1. Create a component with a java implementation, with a service defined by a
Java interface.
The parameter to the method is not a String, primitive or wrapper - rather,
it's a class containing a couple of Strings and an Integer.
2. Expose the service with a webservice binding.
3. Deploy the composite (as a WAR or embedded).
4. Retrieve the WSDL for the service (eg from
http://localhost:8080/SomeServices?wsdl).
5. Generate a web service request from the WSDL.
The runtime fails to map the web service request message to the implementation
class method parameters - it calls the correct method, but the method parameter
is null.
The test works fine when the parameter is a String.
Composite definition (some.composite):
-------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://test" xmlns:test="http://test" name="some">
<service name="SomeServices" promote="SomeServicesComponent">
<binding.ws uri="http://localhost:8080/SomeServices"/>
</service>
<component name="SomeServicesComponent">
<implementation.java class="service.SomeServiceImpl"/>
<service name="SomeService">
<interface.java interface="service.SomeService" />
</service>
</component>
</composite>
Service interface:
-----------------------
/**
*
*/
package service;
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface SomeService {
public AnObject getUsingString(String stringParam);
public AnObject getUsingMoreComplexObject(MoreComplexObject
moreComplexParam);
}
Implementation:
----------------------
package service;
import org.osoa.sca.annotations.Service;
@Service(SomeService.class)
public class SomeServiceImpl implements SomeService {
public AnObject getUsingString(String stringParam) {
System.out.println("Param value:" + stringParam);
return getAnObject(stringParam);
}
private AnObject getAnObject(String stringParam) {
// TODO Auto-generated method stub
return new AnObject(stringParam + "123", 123);
}
public AnObject getUsingMoreComplexObject(MoreComplexObject
moreComplexParam) {
System.out.println("Param value:" + moreComplexParam.getStringParam());
return getAnObject(moreComplexParam.getStringParam());
}
}
MoreComplexObject.java
-----------------------------------
/**
*
*/
package service;
import java.io.Serializable;
public class MoreComplexObject implements Serializable{
private static final long serialVersionUID = 43242314234123L;
private String stringParam;
private Integer intParam;
private String stringParam2;
public String getStringParam() {
return stringParam;
}
public void setStringParam(String stringParam) {
this.stringParam = stringParam;
}
public Integer getIntParam() {
return intParam;
}
public void setIntParam(Integer intParam) {
this.intParam = intParam;
}
public String getStringParam2() {
return stringParam2;
}
public void setStringParam2(String stringParam2) {
this.stringParam2 = stringParam2;
}
}
AnObject.java
-------------
package service;
public class AnObject {
private String someRetValue;
private Integer someOtherRetValue;
public AnObject() {
}
public AnObject(String someRetValue, Integer someOtherRetValue) {
this.someRetValue = someRetValue;
this.someOtherRetValue = someOtherRetValue;
}
/**
* @return the someOtherRetValue
*/
public Integer getSomeOtherRetValue() {
return someOtherRetValue;
}
/**
* @param someOtherRetValue the someOtherRetValue to set
*/
public void setSomeOtherRetValue(Integer someOtherRetValue) {
this.someOtherRetValue = someOtherRetValue;
}
/**
* @return the someRetValue
*/
public String getSomeRetValue() {
return someRetValue;
}
/**
* @param someRetValue the someRetValue to set
*/
public void setSomeRetValue(String someRetValue) {
this.someRetValue = someRetValue;
}
}
WSDL returned by http://localhost:8080/SomeServices?wsdl
-------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://service"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://service/xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:ns1="http://service">
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://service/xsd" xmlns:ax21="http://service/xsd">
<xs:complexType name="MoreComplexObject">
<xs:sequence>
<xs:element minOccurs="0" name="intParam" nillable="true"
type="xs:int"/>
<xs:element minOccurs="0" name="stringParam" nillable="true"
type="xs:string"/>
<xs:element minOccurs="0" name="stringParam2" nillable="true"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AnObject">
<xs:sequence>
<xs:element minOccurs="0" name="someOtherRetValue"
nillable="true" type="xs:int"/>
<xs:element minOccurs="0" name="someRetValue" nillable="true"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://service" xmlns:ns="http://service">
<xs:element name="getUsingMoreComplexObject">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="param0" nillable="true"
type="ns0:MoreComplexObject"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getUsingMoreComplexObjectResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true"
type="ns0:AnObject"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getUsingString">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="param0" nillable="true"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getUsingStringResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true"
type="ns0:AnObject"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="getUsingStringResponse">
<wsdl:part name="parameters" element="ns1:getUsingStringResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getUsingMoreComplexObjectResponse">
<wsdl:part name="parameters"
element="ns1:getUsingMoreComplexObjectResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getUsingStringRequest">
<wsdl:part name="parameters" element="ns1:getUsingString">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getUsingMoreComplexObjectRequest">
<wsdl:part name="parameters" element="ns1:getUsingMoreComplexObject">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="SomeServicePortType">
<wsdl:operation name="getUsingString">
<wsdl:input message="ns1:getUsingStringRequest"
wsaw:Action="urn:getUsingString">
</wsdl:input>
<wsdl:output message="ns1:getUsingStringResponse"
wsaw:Action="urn:getUsingStringResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getUsingMoreComplexObject">
<wsdl:input message="ns1:getUsingMoreComplexObjectRequest"
wsaw:Action="urn:getUsingMoreComplexObject">
</wsdl:input>
<wsdl:output message="ns1:getUsingMoreComplexObjectResponse"
wsaw:Action="urn:getUsingMoreComplexObjectResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SomeServiceHttpBinding" type="ns1:SomeServicePortType">
<http:binding verb="POST"/>
<wsdl:operation name="getUsingString">
<http:operation location="SomeService/getUsingString"/>
<wsdl:input>
<mime:content part="getUsingString" type="text/xml"/>
</wsdl:input>
<wsdl:output>
<mime:content part="getUsingString" type="text/xml"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getUsingMoreComplexObject">
<http:operation location="SomeService/getUsingMoreComplexObject"/>
<wsdl:input>
<mime:content part="getUsingMoreComplexObject" type="text/xml"/>
</wsdl:input>
<wsdl:output>
<mime:content part="getUsingMoreComplexObject" type="text/xml"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SomeServiceSOAP11Binding" type="ns1:SomeServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getUsingString">
<soap:operation soapAction="urn:getUsingString" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getUsingMoreComplexObject">
<soap:operation soapAction="urn:getUsingMoreComplexObject"
style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="SomeServicePortType__SOAPBinding"
type="ns1:SomeServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getUsingString">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getUsingMoreComplexObject">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SomeService">
<wsdl:port name="SomeServiceHttpport" binding="ns1:SomeServiceHttpBinding">
<http:address location="http://localhost:8080/SomeServices"/>
</wsdl:port>
<wsdl:port name="SomeServiceSOAP11port_http"
binding="ns1:SomeServiceSOAP11Binding">
<soap:address location="http://localhost:8080/SomeServices"/>
</wsdl:port>
</wsdl:service>
<wsdl:service name="SomeServicePortType__Service">
<wsdl:port name="SomeServicePortType__SOAPHTTPPort"
binding="ns1:SomeServicePortType__SOAPBinding">
<soap:address location="http://localhost:8080/SomeServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
SOAP payload:
--------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://service" xmlns:xsd="http://service/xsd">
<soapenv:Header/>
<soapenv:Body>
<ser:getUsingMoreComplexObject>
<ser:param0>
<xsd:intParam>12</xsd:intParam>
<xsd:stringParam>Param_1</xsd:stringParam>
<xsd:stringParam2>Param2</xsd:stringParam2>
</ser:param0>
</ser:getUsingMoreComplexObject>
</soapenv:Body>
</soapenv:Envelope>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.