users@glassfish.java.net

Re: server side webservice java ee architecture question

From: Stephen DiMilla <Stephen.Dimilla_at_Sun.COM>
Date: Mon, 06 Mar 2006 13:12:52 -0500

Here's a snippet of code from one of the CTS tests that creates a
SOAPFault but it
does a SOAPFactory.newInstance().createFault(...) to create a SOAPFAULT.
Perhaps the SOAPFactory.newInstance() would suffice.
---------------------------

import javax.xml.ws.soap.SOAPFaultException;
import javax.xml.namespace.QName;
import javax.xml.soap.Detail;
import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.Name;
import javax.jws.WebService;

@WebService(
    portName="Hello2Port",
    targetNamespace="http://dlhandlerservice.org/wsdl",
    serviceName="DLHandlerService",
    
endpointInterface="com.sun.ts.tests.jaxws.sharedwebservices.dlhandlerservice.Hello2"
)
public class Hello2Impl implements Hello2 {
    private final String NAMESPACEURI = "http://dlhandlerservice.org/wsdl";
    private Detail detail = null;
    private QName faultCode = new QName(NAMESPACEURI, "ItsASoapFault",
"tns");
    private Name name = null;
    private String faultString = null;
    private String faultActor = "faultActor";

    public
com.sun.ts.tests.jaxws.sharedwebservices.dlhandlerservice.MyResultType
doHandlerTest2(MyActionType action) {
         String faultString =
"Hello2Impl:EndpointRemoteSOAPFaultExceptionTest";
         try {
            name = SOAPFactory.newInstance().createName("somefaultentry");
           SOAPFault sf =
SOAPFactory.newInstance().createFault(faultString, faultCode);
           sf.setFaultActor(faultActor);
           sf.addDetail();
           sf.getDetail().addDetailEntry(name);
            SOAPFaultException sfe = new SOAPFaultException(sf);
            throw new WebServiceException("WebServiceException with
nested SOAPFaultException", sfe);
         } catch (Exception e) {
         ...

------------------------
Stephen DiMilla
Sun Microsystems Inc.

Mark Hansen wrote:

> I think maybe glassfish is a better place for me to post this ....
>
> -------- Original Message --------
> Subject: server side java ee architecture question
> Date: Sat, 04 Mar 2006 08:21:24 -0500
> From: Mark Hansen <mark_at_javector.com>
> Reply-To: users_at_jax-ws.dev.java.net
> To: users_at_jax-ws.dev.java.net
>
>
>
> Does a server side Java EE deployment of a web service (i.e.,
> @WebService or @WebServiceProvider) implement the javax.xml.ws.Binding
> interface? I'm looking at the JAX-WS spec and trying to understand
> how Figure 9.1 (Handler architecture) applied to Java EE endpoints.
>
> In addition to just trying to understand the architecture, I'm trying
> to figure out if there is a way to access the javax.xml.ws.Binding
> from inside a @WebService or one of its Handlers at runtime?
>
> Specifically, I'd like to be able to use the
> SOAPBinding.getSOAPFactory() on the server side so I can use it for
> creating SAAJ elements (faults and detail elements). But, maybe this
> is the wrong approach. Am I supposed to use injection like:
>
> @Resource
> SOAPFactory fac;
>
> to get an instance of SOAPFactory??
>
> Thanks for any explanations,
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>