[jboss-user] [JBossWS] - Re: SoapFault on returning the web service response
richard.opalka@jboss.com
do-not-reply at jboss.com
Wed Jan 9 10:13:36 EST 2008
Hi,
I followed your usecase and here are the source codes I created:
package org.jboss.test.ws.jaxws.jbws1845;
|
| import javax.ejb.Stateless;
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebResult;
| import javax.jws.WebService;
| import javax.xml.ws.ResponseWrapper;
|
| import org.jboss.wsf.spi.annotation.WebContext;
|
| @Stateless
| @WebService
| (
| targetNamespace="http://service.responsys.com/rsystools/ws/SpamComplaintWS/1.0",
| serviceName="SpamService"
| )
| @WebContext
| (
| transportGuarantee="NONE",
| contextRoot="/jaxws-jbws1845",
| urlPattern="/SpamService"
| )
| public final class SpamComplaintWS implements SpamComplaintWSIface
| {
| @WebMethod(operationName="processSpamComplaints")
| @WebResult(name="SpamResult")
| @ResponseWrapper(className="org.jboss.test.ws.jaxws.jbws1845.jaxws.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)
| {
| return new SpamResult(email, fromAddress, mailDate, complaintDate, mailbox, complainer, xRext, accountName);
| }
| }
|
package org.jboss.test.ws.jaxws.jbws1845;
|
| import javax.ejb.Remote;
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebResult;
| import javax.jws.WebService;
| import javax.xml.ws.ResponseWrapper;
|
| @Remote
| @WebService
| public interface SpamComplaintWSIface
| {
| @WebMethod(operationName="processSpamComplaints")
| @WebResult(name="SpamResult")
| @ResponseWrapper(className="org.jboss.test.ws.jaxws.jbws1845.jaxws.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
| );
| }
|
package org.jboss.test.ws.jaxws.jbws1845;
|
| import javax.xml.bind.annotation.XmlAccessType;
| import javax.xml.bind.annotation.XmlAccessorType;
| import javax.xml.bind.annotation.XmlElement;
| import javax.xml.bind.annotation.XmlType;
|
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "SpamResult", propOrder = {
| "email",
| "fromAddress",
| "mailDate",
| "complaintDate",
| "mailbox",
| "complainer",
| "xRext",
| "accountName"
| })
| public final class SpamResult
| {
| @XmlElement(required = true, nillable = true)
| protected String email;
| @XmlElement(required = true, nillable = true)
| protected String fromAddress;
| @XmlElement(required = true, nillable = true)
| protected String mailDate;
| @XmlElement(required = true, nillable = true)
| protected String complaintDate;
| @XmlElement(required = true, nillable = true)
| protected String mailbox;
| @XmlElement(required = true, nillable = true)
| protected String complainer;
| @XmlElement(required = true, nillable = true)
| protected String xRext;
| @XmlElement(required = true, nillable = true)
| protected String accountName;
|
| public SpamResult()
| {
| }
|
| public SpamResult(String email, String fromAddress, String mailDate, String complaintDate, String mailbox, String complainer, String xRext, String accountName)
| {
| this.email = email;
| this.fromAddress = fromAddress;
| this.mailDate = mailDate;
| this.complaintDate = complaintDate;
| this.mailbox = mailbox;
| this.complainer = complainer;
| this.xRext = xRext;
| this.accountName = accountName;
| }
|
| public String[] get()
| {
| return new String[] { email, fromAddress, mailDate, complaintDate, mailbox, complainer, xRext, accountName };
| }
| }
|
package org.jboss.test.ws.jaxws.jbws1845;
|
| import java.net.URL;
| import javax.xml.namespace.QName;
| import javax.xml.ws.Service;
| import junit.framework.Test;
| import org.jboss.wsf.test.JBossWSTest;
| import org.jboss.wsf.test.JBossWSTestSetup;
|
| public final class JBWS1845TestCase extends JBossWSTest
| {
| public static Test suite()
| {
| return new JBossWSTestSetup(JBWS1845TestCase.class, "jaxws-jbws1845.jar");
| }
|
| public void testIssue() throws Exception
| {
| QName serviceName = new QName("http://service.responsys.com/rsystools/ws/SpamComplaintWS/1.0", "SpamService");
| URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1845/SpamService?wsdl");
|
| Service service = Service.create(wsdlURL, serviceName);
| SpamComplaintWSIface proxy = (SpamComplaintWSIface)service.getPort(SpamComplaintWSIface.class);
|
| String[] orig = { "email", "fromAddress", "mailDate", "complaintDate", "mailbox", "complainer", "xRext", "accountName"};
| String[] returned = proxy.processSpamComplaints(orig[0], orig[1], orig[2], orig[3], orig[4], orig[5], orig[6], orig[7]).get();
| for (int i = 0; i < orig.length; i++)
| {
| assertEquals(orig, returned);
| }
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118314#4118314
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118314
More information about the jboss-user
mailing list