[JBossWS] - Re: SoapFault on returning the web service response
by richard.opalka@jboss.com
This is the generated WSDL
<definitions name="SpamService" targetNamespace="http://service.responsys.com/rsystools/ws/SpamComplaintWS/1.0" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.responsys.com/rsystools/ws/SpamComplaintWS/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
| <types>
| <xs:schema targetNamespace="http://service.responsys.com/rsystools/ws/SpamComplaintWS/1.0" version="1.0" xmlns:tns="http://service.responsys.com/rsystools/ws/SpamComplaintWS/1.0" 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:SpamResult"/>
| </xs:sequence>
| </xs:complexType>
| <xs:complexType final="extension restriction" name="SpamResult">
| <xs:sequence>
| <xs:element name="email" nillable="true" type="xs:string"/>
| <xs:element name="fromAddress" nillable="true" type="xs:string"/>
| <xs:element name="mailDate" nillable="true" type="xs:string"/>
| <xs:element name="complaintDate" nillable="true" type="xs:string"/>
| <xs:element name="mailbox" nillable="true" type="xs:string"/>
| <xs:element name="complainer" nillable="true" type="xs:string"/>
| <xs:element name="xRext" nillable="true" type="xs:string"/>
| <xs:element name="accountName" nillable="true" type="xs:string"/>
| </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="SpamService">
| <port binding="tns:SpamComplaintWSBinding" name="SpamComplaintWSPort">
| <soap:address location="http://localhost.localdomain:8080/jaxws-jbws1845/SpamService"/>
| </port>
| </service>
| </definitions>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118316#4118316
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118316
18 years, 3 months
[EJB 3.0] - [Beginner] Remote Client Dependency Injection doesn't work..
by francis1970
Hi all !
I have found an EJB 3 example from Oracle site, it uses dependency injection to invoke the EJB. Unfortunately it doesn't work on JBoss....I get a "NullPointerException" when I invoke the sayHello method.
Added also Context information but still doesn't work.
Do I need to add some configuration file to the EJB's jar file so that dependency injection works ???
This is the EJB
package oracle.ejb30;
|
| import javax.ejb.Remote;
| @Remote
| public interface HelloWorld {
| public void sayHello(String name);
| }
|
| -----------------------------------------------------
| package oracle.ejb30;
|
| import javax.ejb.Stateless;
|
| @Stateless
| public class HelloWorldBean implements HelloWorld {
| public void sayHello(String name) {
| System.out.println("Hello " + name
| + " from your first EJB 3.0 component ...");
| }
| }
| -------------------------------------------------------
| package oracle.ejb30;
|
| import javax.ejb.EJB;
| import java.util.*;
| import javax.naming.*;
|
| public class HelloWorldClient {
| @EJB
| private static HelloWorld helloWorld;
|
| public static void main(String[] args) throws NamingException {
| Properties env = new Properties();
| env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| env.setProperty("java.naming.provider.url", "localhost:1099");
| env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
| Context ctx = new InitialContext(env);
|
| System.out.println("Using Dependency Injection .. invoking sayHello ");
| helloWorld.sayHello("Debu Panda!");
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118315#4118315
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118315
18 years, 3 months
[JBossWS] - Re: SoapFault on returning the web service response
by richard.opalka@jboss.com
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
18 years, 3 months