users@glassfish.java.net

Re: _at_EJB injection for an _at_WebService object only works from the Admin Cons

From: <glassfish_at_javadesktop.org>
Date: Mon, 23 Feb 2009 04:17:34 PST

Here are some code snippets to show the problem:

In the WebService implementation class I have:
@WebService(targetNamespace = "http://www.pascalalma.net/EchoIt",
            portName="EchoItPort",
            serviceName="EchoItService",
            endpointInterface="net.pascalalma.echoit.EchoItPortType")
public class EchoItPortTypeImpl {

    @EJB
    private CustomerServiceLocal cs;


    public String echoIt(String it)
    {

        return "Echo " + it +": " + cs;
    }
}


In the Admin tester with URL 'http://localhost:8080/my-ws/EchoItService?tester' I get:
SOAP Request

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:EchoIt xmlns:ns2="http://www.pascalalma.net/EchoIt/types">
<textToEcho>12</textToEcho>
</ns2:EchoIt>
</S:Body>
</S:Envelope>
SOAP Response

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:EchoItResponse xmlns:ns2="http://www.pascalalma.net/EchoIt/types">
<echoedText>Echo 12: net.pascalalma.myservices.CustomerServiceLocal_16516284</echoedText>
</ns2:EchoItResponse>
</S:Body>
</S:Envelope>

In SoapUI with test url 'http://localhost:8080/my-ws/services/echoit' (based on content of web.xml):
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.pascalalma.net/EchoIt/types">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:EchoIt>
         <textToEcho>12</textToEcho>
      </typ:EchoIt>
   </soapenv:Body>
</soapenv:Envelope>
Response:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:EchoItResponse xmlns:ns2="http://www.pascalalma.net/EchoIt/types">
         <echoedText>Echo 12: null</echoedText>
      </ns2:EchoItResponse>
   </S:Body>
</S:Envelope>

Why does Glassfish behave differently when using the expected URl instead of its internal constructed one ?
[Message sent by forum member 'palma_it' (palma_it)]

http://forums.java.net/jive/thread.jspa?messageID=333327