I have created a simple JAX-WS web service to process spam complaints
Here is the Java code of it:
@WebService(targetNamespace="http://service.responsys.com/rsystools/ws/SpamComplaintWS/1.0")
| public class SpamComplaintWS
| {
| @WebMethod(operationName="processSpamComplaints")
| @WebResult(name="SpamResult")
| @ResponseWrapper(className="com.rsys.rsystools.ws.SpamResult")
| public SpamResult processSpamComplaints(
| @WebParam(name = "email") String email,
| @WebParam(name = "fromAddress") String fromAddress,
| @WebParam(name = "mailDate") String mailDate,
| @WebParam(name = "complaintDate") String complaintDate,
| @WebParam(name = "mailbox") String mailbox,
| @WebParam(name = "complainer") String complainer,
| @WebParam(name = "xRext") String xRext,
| @WebParam(name = "accountName") String accountName)
| {
| responsys.prodtools.SpammerTables st = new
responsys.prodtools.SpammerTables();
| String[] res = st.processSpamRecord(email, fromAddress, mailDate,
complaintDate, mailbox, complainer, xRext, accountName);
| return (new
SpamResult(res[0],res[1],res[2],res[3],res[4],res[5],res[6],res[7],res[8],res[9],res[10],res[11],res[12],res[13]));
| }
| }
|
It compiles and deploys successfully, however, generated wsdl is not what I expected to
see:
- <definitions name="SpamComplaintWSService"
targetNamespace="http://service.responsys.com/rsystools/ws/SpamCompl...
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://service.responsys.com/rsystools/ws/SpamComplaintWS...
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
| - <types>
| - <xs:schema
targetNamespace="http://service.responsys.com/rsystools/ws/SpamCompl...
version="1.0"
xmlns:tns="http://service.responsys.com/rsystools/ws/SpamComplaintWS...
xmlns:xs="http://www.w3.org/2001/XMLSchema">
| <xs:element name="processSpamComplaints"
type="tns:processSpamComplaints" />
| <xs:element name="processSpamComplaintsResponse"
type="tns:processSpamComplaintsResponse" />
| - <xs:complexType name="processSpamComplaints">
| - <xs:sequence>
| <xs:element minOccurs="0" name="email"
type="xs:string" />
| <xs:element minOccurs="0" name="fromAddress"
type="xs:string" />
| <xs:element minOccurs="0" name="mailDate"
type="xs:string" />
| <xs:element minOccurs="0" name="complaintDate"
type="xs:string" />
| <xs:element minOccurs="0" name="mailbox"
type="xs:string" />
| <xs:element minOccurs="0" name="complainer"
type="xs:string" />
| <xs:element minOccurs="0" name="xRext"
type="xs:string" />
| <xs:element minOccurs="0" name="accountName"
type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| - <xs:complexType name="processSpamComplaintsResponse">
| - <xs:sequence>
| <xs:element minOccurs="0" name="SpamResult"
type="tns:processSpamComplaintsResponse" />
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| - <message name="SpamComplaintWS_processSpamComplaints">
| <part element="tns:processSpamComplaints"
name="processSpamComplaints" />
| </message>
| - <message name="SpamComplaintWS_processSpamComplaintsResponse">
| <part element="tns:processSpamComplaintsResponse"
name="processSpamComplaintsResponse" />
| </message>
| - <portType name="SpamComplaintWS">
| - <operation name="processSpamComplaints"
parameterOrder="processSpamComplaints">
| <input message="tns:SpamComplaintWS_processSpamComplaints" />
| <output message="tns:SpamComplaintWS_processSpamComplaintsResponse"
/>
| </operation>
| </portType>
| - <binding name="SpamComplaintWSBinding"
type="tns:SpamComplaintWS">
| <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
| - <operation name="processSpamComplaints">
| <soap:operation soapAction="" />
| - <input>
| <soap:body use="literal" />
| </input>
| - <output>
| <soap:body use="literal" />
| </output>
| </operation>
| </binding>
| - <service name="SpamComplaintWSService">
| - <port binding="tns:SpamComplaintWSBinding"
name="SpamComplaintWSPort">
| <soap:address
location="http://127.0.0.1:80/RsysTools/ws/SpamComplaintWS" />
| </port>
| </service>
| </definitions>
|
(It is copied from the browser, so, don't mind dashes).
As you can see, I explicitly stated the name and class for my return value but wsdl
ignores that part. I mean @WebResult and @ResponceWrapper annotations.
I can call the web service in it successfully performs its job (I know it by the results
of the database transaction) by I still getting an exception on result return:
javax.xml.ws.soap.SOAPFaultException: java.lang.reflect.UndeclaredThrowableException
| at
com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:171)
| at
com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:94)
| at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:240)
| at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
| at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
| at $Proxy29.processSpamComplaints(Unknown Source)
| at
com.rsys.rsystools.client.SpamComplainClient.doComplain(SpamComplainClient.java:409)
|
Can someone tells me what is wrong with my code and how to make it work.
I am doing it on JBoss 4.2.1 with the JBossWS 2.0.1GA
Thanks.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093226#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...