Hello, 

I'm trying to investigate Tuscany possibilities to work with external web 
services (for example, provided by AXIS).

I created a very simple AXIS2 web service, which is deployed as POJO on Tomcat. 
Here is the interface it provides:

public interface DemoService {

    public void voidMethod();

    public void voidMethodWithParams(int param1, String param2, BigDecimal 
param3);

    public String echoMethod(String value);

    public String 
paramStructureMethod(samples.quickstart.service.pojo.DemoParamStructure 
structure);

    public samples.quickstart.service.pojo.DemoParamStructure 
resultStructureMethod(int param1, String param2, BigDecimal param3);
}

samples.quickstart.service.pojo.DemoParamStructure is a simple java bean:

public class DemoParamStructure {

    private int integerParam;

    private String stringParam;

    private BigDecimal decimalParam;

    // ... getters and setters
}

At Tuscany side, I created a reference to this web service and placed WSDL file 
generated by AXIS somewhere under Tuscany domain:

<reference name="stub">
    <interface.java interface="com.sample.tuscany.test.DemoServiceStub"/>
    <binding.ws 
wsdlElement="http://pojo.service.quickstart.samples#wsdl.port(DemoService/DemoServiceHttpSoap11Endpoint)"/>
</reference>

The first 4 methods worked fine, however I was not able to get the correct 
result from the last method, which returned java bean as a result. I created 
the same java bean class (samples.quickstart.service.pojo.DemoParamStructure) 
at Tuscany side and used this class in reference interface:

@Remotable
public interface DemoServiceStub {

    @Oneway
    public void voidMethod();

    @Oneway
    public void voidMethodWithParams(int param1, String param2, BigDecimal 
param3);

    public String echoMethod(String value);

    public String 
paramStructureMethod(samples.quickstart.service.pojo.DemoParamStructure 
structure);

    public samples.quickstart.service.pojo.DemoParamStructure 
resultStructureMethod(int param1, String param2, BigDecimal param3);
}

What I got from calling DemoServiceStub.resultStructureMethod(...) method was 
the instance of samples.quickstart.service.pojo.DemoParamStructure class with 
EMPTY private fields. SOAP monitor showed the following SOAP result message, 
which had values provided for every field:

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
<soapenv:Body>
    <ns:resultStructureMethodResponse 
xmlns:ns="http://pojo.service.quickstart.samples";>
        <ns:return xmlns:ax23="http://pojo.service.quickstart.samples/xsd"; 
type="samples.quickstart.service.pojo.DemoParamStructure">
            <ax23:decimalParam>3</ax23:decimalParam>
            <ax23:integerParam>1</ax23:integerParam>
            <ax23:stringParam>2</ax23:stringParam>
        </ns:return>
    </ns:resultStructureMethodResponse>
</soapenv:Body>
</soapenv:Envelope>

I am not an experienced web service developer, so most probably I missed 
something... It looks like XML to Java mapping is not working correctly in my 
case and skips values for private fields.

I also generated AXIS2 client using ADB and it worked fine. The result SOAP 
message was almost the same, except that it used 
http://www.w3.org/2003/05/soap-envelope namespace which seems to be OK since 
AXIS2 client uses SOAP 1.2.

Can you please advice?

Thanks and kind regards,
Dzmitry

Reply via email to