Exception while sending/receiving param using web-service
mayankmaria Jul 4, 2006 7:42 AMHere is my wsdl For calculator example service :-
<definitions name="CalculatorService" targetNamespace="http://RSPL.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://RSPL.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <types> <schema elementFormDefault="qualified" targetNamespace="http://RSPL.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://RSPL.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <complexType name="add"> <sequence> <element name="arg0" nillable="true" type="string" /> </sequence> </complexType> <complexType name="addResponse"> <sequence /> </complexType> <element name="add" type="tns:add" /> <element name="addResponse" type="tns:addResponse" /> </schema> </types> <message name="Calculator_addResponse"> <part element="tns:addResponse" name="result" /> </message> <message name="Calculator_add"> <part element="tns:add" name="parameters" /> </message> <portType name="Calculator"> <operation name="add"> <input message="tns:Calculator_add" /> <output message="tns:Calculator_addResponse" /> </operation> </portType> <binding name="CalculatorBinding" type="tns:Calculator"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="add"> <soap:operation soapAction="" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="CalculatorService"> <port binding="tns:CalculatorBinding" name="CalculatorPort"> <soap:address location="http://rspl65:8080/CC/CalculatorBean" /> </port> </service> </definitions>
The client code is as shown below..
public static void main(String args[]) { try { Client client = new Client(); service = javax.xml.ws.Service.create(new URL("http://rspl65:8080/CC/CalculatorBean?wsdl"), new QName("http//RSPL.com" ,"CalculatorService")); client.doTest(); } catch(Exception e) { e.printStackTrace(); } } public void doTest() { try { Iterator it = service.getPorts(); for(;it.hasNext();){ System.out.println(it.next()); } Calculator port = service.getCalculatorPort(); System.out.println(port); port.add("TEST"); } catch(Exception e) { e.printStackTrace(); } }
The Exception thrown here in this code is shown below
{http://RSPL.com}CalculatorPort com.sun.xml.ws.client.EndpointIFInvocationHandler@1a33d48 javax.xml.bind.JAXBException: arg0 is not a valid property on class com.RSPL.jaxws.Add at com.sun.xml.ws.encoding.soap.EncoderDecoder.createJAXBBeanPayload(EncoderDecoder.java:261) at com.sun.xml.ws.encoding.soap.EncoderDecoder.createDocLitPayloadValue(EncoderDecoder.java:193) at com.sun.xml.ws.encoding.soap.EncoderDecoder.createPayload(EncoderDecoder.java:162) at com.sun.xml.ws.encoding.soap.ClientEncoderDecoder.toInternalMessage(ClientEncoderDecoder.java:326) at com.sun.xml.ws.encoding.soap.ClientEncoderDecoder.toInternalMessage(ClientEncoderDecoder.java:64) at com.sun.xml.ws.encoding.soap.client.SOAPXMLEncoder.toInternalMessage(SOAPXMLEncoder.java:140) at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.java:161) at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.java:137) at com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:84) at com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocationHandler.java:172) at com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.java:106) at $Proxy14.add(Unknown Source) at Client.doTest(Client.java:77) at Client.main(Client.java:59) Caused by: javax.xml.bind.JAXBException: arg0 is not a valid property on class com.RSPL.jaxws.Add at com.sun.xml.ws.encoding.EncoderDecoderBase.getRawAccessor(EncoderDecoderBase.java:126) at com.sun.xml.ws.encoding.EncoderDecoderBase.setWrapperChildValue(EncoderDecoderBase.java:106) at com.sun.xml.ws.encoding.soap.EncoderDecoder.createJAXBBeanPayload(EncoderDecoder.java:256) ... 13 more Caused by: javax.xml.bind.JAXBException: arg0 is not a valid property on class com.RSPL.jaxws.Add at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:781) at com.sun.xml.ws.encoding.EncoderDecoderBase.getRawAccessor(EncoderDecoderBase.java:122) ... 15 more
It displays that the service is created also the port is opened but when u try to call the method with the parameter it displays an error saying property is not valid..
If anybody can locate the problem would be much usefull.