Soap service returning complex objects(Such as hashmaps) inc
mwkohout Nov 28, 2007 11:12 AMHello All.
I've got a soap service(which is also a seam component) with a method that returns a hashmap. Through debugging I know that my method is returning a valid set of java objects but from client code( Ruby and Java) all I'm getting is a null value. Other methods that return simple strings or return an array of Longs work perfectly.
as far as my platform I'm running on jboss 4.2.1GA with Seam 2.0.0GA.
here's the relevant server code. The first method is one that works incorrectly and the bottom two work:
@WebService() @SOAPBinding( parameterStyle=SOAPBinding.ParameterStyle.BARE, style=SOAPBinding.Style.RPC) //@SOAPBinding(style = SOAPBinding.Style.RPC) @Name("StudyServiceWS") @Scope(value=ScopeType.STATELESS) @Stateless public class StudyService implements StudyServiceRemote{ //this is a test method that currently returns a null to the client @WebMethod public HashMap getHashMap( String key, String value) { HashMap m = new HashMap(); m.put( key, value); return m; } //this method works @WebMethod() public String echo( @WebParam(name = "echo")String echo) { return echo; } //this also works @WebMethod public Long[] getStudyIDs( String x500) { Long[] returnIDs = null; UserHome userHome = (UserHome)Component.getInstance( UserHome.class, true); User user = userHome.findByInternetID(x500); ...... return returnIDs; }
generated wsdl:
<definitions name='StudyServiceService' targetNamespace='http://webService.core.ictr.umn.edu/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://jaxb.dev.java.net/array' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://webService.core.ictr.umn.edu/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <types> <xs:schema targetNamespace='http://webService.core.ictr.umn.edu/' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:complexType name='hashMap'> <xs:complexContent> <xs:extension base='ns1:abstractMap' xmlns:ns1='http://webService.core.ictr.umn.edu/'> <xs:sequence/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType abstract='true' name='abstractMap'/> <xs:complexType name='arrayList'> <xs:complexContent> <xs:extension base='ns2:abstractList' xmlns:ns2='http://webService.core.ictr.umn.edu/'> <xs:sequence/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType abstract='true' name='abstractList'> <xs:complexContent> <xs:extension base='ns3:abstractCollection' xmlns:ns3='http://webService.core.ictr.umn.edu/'> <xs:sequence/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType abstract='true' name='abstractCollection'/> </xs:schema> <xs:schema targetNamespace='http://jaxb.dev.java.net/array' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:complexType final='#all' name='longArray'> <xs:sequence> <xs:element maxOccurs='unbounded' minOccurs='0' name='item' nillable='true' type='xs:long'/> </xs:sequence> </xs:complexType> </xs:schema> </types> <message name='StudyService_getHashMap'> <part name='arg0' type='xsd:string'></part> <part name='arg1' type='xsd:string'></part> </message> <message name='StudyService_getStudyIDs'> <part name='arg0' type='xsd:string'></part> </message> <message name='StudyService_getSubjects'> <part name='arg0' type='xsd:long'></part> </message> <message name='StudyService_getSubjectsResponse'> <part name='return' type='tns:arrayList'></part> </message> <message name='StudyService_getStudies'> <part name='x500' type='xsd:string'></part> </message> <message name='StudyService_getStudy'> <part name='arg0' type='xsd:string'></part> <part name='arg1' type='xsd:long'></part> </message> <message name='StudyService_echo'> <part name='echo' type='xsd:string'></part> </message> <message name='StudyService_getStudyResponse'> <part name='return' type='tns:hashMap'></part> </message> <message name='StudyService_getStudyIDsResponse'> <part name='return' type='ns1:longArray'></part> </message> <message name='StudyService_getSubjectsStringOperation'> <part name='arg0' type='xsd:string'></part> </message> <message name='StudyService_getStudiesResponse'> <part name='return' type='tns:hashMap'></part> </message> <message name='StudyService_getSubjectsStringOperationResponse'> <part name='return' type='tns:arrayList'></part> </message> <message name='StudyService_echoResponse'> <part name='return' type='xsd:string'></part> </message> <message name='StudyService_getHashMapResponse'> <part name='return' type='tns:hashMap'></part> </message> <portType name='StudyService'> <operation name='echo' parameterOrder='echo'> <input message='tns:StudyService_echo'></input> <output message='tns:StudyService_echoResponse'></output> </operation> <operation name='getHashMap' parameterOrder='arg0 arg1'> <input message='tns:StudyService_getHashMap'></input> <output message='tns:StudyService_getHashMapResponse'></output> </operation> <operation name='getStudies' parameterOrder='x500'> <input message='tns:StudyService_getStudies'></input> <output message='tns:StudyService_getStudiesResponse'></output> </operation> <operation name='getStudy' parameterOrder='arg0 arg1'> <input message='tns:StudyService_getStudy'></input> <output message='tns:StudyService_getStudyResponse'></output> </operation> <operation name='getStudyIDs' parameterOrder='arg0'> <input message='tns:StudyService_getStudyIDs'></input> <output message='tns:StudyService_getStudyIDsResponse'></output> </operation> <operation name='getSubjects' parameterOrder='arg0'> <input message='tns:StudyService_getSubjects'></input> <output message='tns:StudyService_getSubjectsResponse'></output> </operation> <operation name='getSubjectsStringOperation' parameterOrder='arg0'> <input message='tns:StudyService_getSubjectsStringOperation'></input> <output message='tns:StudyService_getSubjectsStringOperationResponse'></output> </operation> </portType> <binding name='StudyServiceBinding' type='tns:StudyService'> <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='echo'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </input> <output> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </output> </operation> <operation name='getHashMap'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </input> <output> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </output> </operation> <operation name='getStudies'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </input> <output> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </output> </operation> <operation name='getStudy'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </input> <output> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </output> </operation> <operation name='getStudyIDs'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </input> <output> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </output> </operation> <operation name='getSubjects'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </input> <output> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </output> </operation> <operation name='getSubjectsStringOperation'> <soap:operation soapAction=''/> <input> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </input> <output> <soap:body namespace='http://webService.core.ictr.umn.edu/' use='literal'/> </output> </operation> </binding> <service name='StudyServiceService'> <port binding='tns:StudyServiceBinding' name='StudyServicePort'> <soap:address location='http://127.0.0.1:8080/StudyServiceService/StudyService'/> </port> </service> </definitions>
Any ideas? Any suggestion or 4 letter word would be welcome.