Back Forum Reply New

Sample WebService using XFire

/soap/envelope/quot; xmlns:wsdl=quot;wsdl/quot;gt;
- lt;wsdl:typesgt;
- lt;xsd:schema attributeFormDefault=quot;qualifiedquot; elementFormDefault=quot;qualifiedquot; targetNamespace=quot;/lt;xsd:complexType name=quot;ClaimContactRequestquot;gt;
- lt;xsd:sequencegt; lt;xsd:element minOccurs=quot;0quot; name=quot;contactsquot; nillable=quot;truequot; type=quot;xsd:stringquot; /gt;  lt;/xsd:sequencegt; lt;/xsd:complexTypegt; lt;/xsd:schemagt;
- lt;xsd:schema attributeFormDefault=quot;qualifiedquot; elementFormDefault=quot;qualifiedquot; targetNamespace=quot;/lt;xsd:element name=quot;getClaimContactsquot;gt;
- lt;xsd:complexTypegt;
- lt;xsd:sequencegt; lt;xsd:element maxOccurs=quot;1quot; minOccurs=quot;1quot; name=quot;in0quot; nillable=quot;truequot; type=quot;ns1:ClaimContactRequestquot; /gt;  lt;/xsd:sequencegt; lt;/xsd:complexTypegt; lt;/xsd:elementgt;
- lt;xsd:element name=quot;getClaimContactsResponsequot;gt;
- lt;xsd:complexTypegt;
- lt;xsd:sequencegt; lt;xsd:element maxOccurs=quot;1quot; minOccurs=quot;1quot; name=quot;outquot; nillable=quot;truequot; type=quot;ns2:ClaimContactResponsequot; /gt;  lt;/xsd:sequencegt; lt;/xsd:complexTypegt; lt;/xsd:elementgt; lt;xsd:element name=quot;BusinessServiceExceptionquot; type=quot;ns3:BusinessServiceExceptionquot; /gt;  lt;/xsd:schemagt;
- lt;xsd:schema attributeFormDefault=quot;qualifiedquot; elementFormDefault=quot;qualifiedquot; targetNamespace=quot;/lt;xsd:complexType name=quot;ClaimContactResponsequot;gt;
- lt;xsd:sequencegt; lt;xsd:element minOccurs=quot;0quot; name=quot;contactsquot; nillable=quot;truequot; type=quot;xsd:stringquot; /gt;  lt;/xsd:sequencegt; lt;/xsd:complexTypegt; lt;/xsd:schemagt;
- lt;xsd:schema attributeFormDefault=quot;qualifiedquot; elementFormDefault=quot;qualifiedquot; targetNamespace=quot;/lt;xsd:complexType name=quot;BusinessServiceExceptionquot; /gt;  lt;/xsd:schemagt; lt;/wsdl:typesgt;
- lt;wsdl:message name=quot;BusinessServiceExceptionquot;gt; lt;wsdl:part name=quot;BusinessServiceExceptionquot; element=quot;tns:BusinessServiceExceptionquot; /gt;  lt;/wsdl:messagegt;
- lt;wsdl:message name=quot;getClaimContactsResponsequot;gt; lt;wsdl:part name=quot;parametersquot; element=quot;tns:getClaimContactsResponsequot; /gt;  lt;/wsdl:messagegt;
- lt;wsdl:message name=quot;getClaimContactsRequestquot;gt; lt;wsdl:part name=quot;parametersquot; element=quot;tns:getClaimContactsquot; /gt;  lt;/wsdl:messagegt;
- lt;wsdl:portType name=quot;IClaimContactDataServicePortTypequot;gt;
- lt;wsdlperation name=quot;getClaimContactsquot;gt; lt;wsdl:input name=quot;getClaimContactsRequestquot; message=quot;tns:getClaimContactsRequestquot; /gt;  lt;wsdlutput name=quot;getClaimContactsResponsequot; message=quot;tns:getClaimContactsResponsequot; /gt;  lt;wsdl:fault name=quot;BusinessServiceExceptionquot; message=quot;tns:BusinessServiceExceptionquot; /gt;  lt;/wsdlperationgt; lt;/wsdl:portTypegt;
- lt;wsdl:binding name=quot;IClaimContactDataServicefromBindingquot; type=quot;tns:IClaimContactDataServicePortTypequot;gt; lt;wsdlsoap:binding style=quot;documentquot; transport=quot;soap/fromquot; /gt;
- lt;wsdlperation name=quot;getClaimContactsquot;gt; lt;wsdlsoapperation soapAction=quot;quot; /gt;
- lt;wsdl:input name=quot;getClaimContactsRequestquot;gt; lt;wsdlsoap:body use=quot;literalquot; /gt;  lt;/wsdl:inputgt;
- lt;wsdlutput name=quot;getClaimContactsResponsequot;gt; lt;wsdlsoap:body use=quot;literalquot; /gt;  lt;/wsdlutputgt;
- lt;wsdl:fault name=quot;BusinessServiceExceptionquot;gt; lt;wsdlsoap:fault name=quot;BusinessServiceExceptionquot; use=quot;literalquot; /gt;  lt;/wsdl:faultgt; lt;/wsdlperationgt; lt;/wsdl:bindinggt;
- lt;wsdl:service name=quot;IClaimContactDataServicequot;gt;
- lt;wsdl:port name=quot;IClaimContactDataServicefromPortquot; binding=quot;tns:IClaimContactDataServicefromBindingquot;gt; lt;wsdlsoap:address location=quot;Integration/services/claimContactDataServicequot; /gt;  lt;/wsdl:portgt; lt;/wsdl:servicegt; lt;/wsdl:definitionsgt;
Client.java
---------

Code:
public class Client {

public static void main(String[] args) {
Service srvcModel = new ObjectServiceFactory()
.create(IClaimContactDataService.class);
XFireProxyFactory factory = new XFireProxyFactory(XFireFactory
.newInstance().getXFire());

String claimucl = quot;.../claimContactDataServicequot;;

try {
IClaimContactDataService srvc = (IClaimContactDataService) factory
.create(srvcModel, claimucl);
String response = srvc.getClaimContacts();       System.out.println(quot;Response: quot; + response);      
} catch (Exception e) {
e.printStackTrace();
}
}
}
When I try to call webservice using client  I am getting following error, Please help.
Code:
  org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException
org.codehaus.xfire.fault.XFireFault: Fault: java.lang.NullPointerException
at org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
at org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
at org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
at org.codehaus.xfire.transport.from.fromChannel.sendViaClient(fromChannel.java:139)
at org.codehaus.xfire.transport.from.fromChannel.send(fromChannel.java:48)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
at org.codehaus.xfire.client.Client.invoke(Client.java:336)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy0.getClaimContacts(Unknown Source)
at com...integration.ab.business.claim.dao.service.Client.main(Client.java:25)Hi!
Can any one help me , Still I am facing same error.

Thanks in Advance.
¥
Back Forum Reply New