Announcement Announcement Module
Collapse
No announcement yet.
Echo.war and weblogic 9.2 – interesting remark… Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Echo.war and weblogic 9.2 – interesting remark…

    Hi All !

    I have developed echo.war from spring-ws samples to weblogic 9.2 and it works nicely.
    I have excluded SAAJ implementation from lib directory to use weblogic implementation. So no problem.

    This is the response I have got from weblogic:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
    <echoResponse xmlns="http://www.springframework.org/spring-ws/samples/echo">Joppa</echoResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    Thinking to my real application I decided to add prefix “ns” to echoResponse element and get response kind of this:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
    <ns:echoResponse xmlns:ns="http://www.springframework.org/spring-ws/samples/echo">Joppa</ns:echoResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    So I have added just one line to EchoEndpoint class (see in bold):

    protected Element invokeInternal(Element requestElement, Document document) throws Exception {
    System.out.println("!!! ECHO. It is invoked !");
    Assert.isTrue(NAMESPACE_URI.equals(requestElement. getNamespaceURI()), "Invalid namespace");
    Assert.isTrue(ECHO_REQUEST_LOCAL_NAME.equals(reque stElement.getLocalName()), "Invalid local name");
    NodeList children = requestElement.getChildNodes();
    Text requestText = null;
    for (int i = 0; i < children.getLength(); i++) {
    if (children.item(i).getNodeType() == Node.TEXT_NODE) {
    requestText = (Text) children.item(i);
    break;
    }
    }
    if (requestText == null) {
    throw new IllegalArgumentException("Could not find request text node");
    }

    String echo = echoService.echo(requestText.getNodeValue());
    Element responseElement = document.createElementNS(NAMESPACE_URI, ECHO_RESPONSE_LOCAL_NAME);
    responseElement.setPrefix("ns"); Text responseText = document.createTextNode(echo);
    responseElement.appendChild(responseText);
    return responseElement;
    }

    After this the application did not work correctly. This is from weblogic log:


    server.SoapMessageDispatcher - Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.Pay loadEndpoint
    Adapter@1d3125a]
    !!! ECHO. It is invoked !
    625 [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] TRACE org.springframework.core.Col
    lectionFactory - Creating [java.util.LinkedHashMap]
    ERROR: 'This is not an attribute, it is a namespace:xmlns:ns'
    625 [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.ws.soap.
    server.SoapMessageDispatcher - Testing endpoint exception resolver [org.springframework.ws.soap.server.endpoint.Simple S
    oapExceptionResolver@59ee51]
    625 [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.ws.trans
    port.http.MessageDispatcherServlet - Could not complete request
    java.lang.IllegalStateException
    at java.util.AbstractList$Itr.remove(AbstractList.jav a:433)
    at org.springframework.ws.soap.saaj.Saaj11Implementat ion.removeContents(Saaj11Implementation.java:273)
    at org.springframework.ws.soap.saaj.SaajSoap11Body.ad dFault(SaajSoap11Body.java:53)
    at org.springframework.ws.soap.saaj.SaajSoap11Body.ad dServerOrReceiverFault(SaajSoap11Body.java:72)
    at org.springframework.ws.soap.server.endpoint.Simple SoapExceptionResolver.resolveExceptionInternal(Sim pleSoapEx
    ceptionResolver.java:35)
    at org.springframework.ws.server.endpoint.AbstractEnd pointExceptionResolver.resolveException(AbstractEn dpointExc
    eptionResolver.java:60)
    at org.springframework.ws.server.MessageDispatcher.pr ocessEndpointException(MessageDispatcher.java:291)
    at org.springframework.ws.server.MessageDispatcher.di spatch(MessageDispatcher.java:212)
    at org.springframework.ws.server.MessageDispatcher.re ceive(MessageDispatcher.java:145)
    at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMe
    ssageReceiverObjectSupport.java:84)
    at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceive
    rHandlerAdapter.java:56)
    at org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:123)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:461)
    at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:426)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    at weblogic.servlet.internal.StubSecurityHelper$Servl etServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invok eServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:283)
    at weblogic.servlet.internal.ServletStubImpl.execute( ServletStubImpl.java:175)
    at weblogic.servlet.internal.WebAppServletContext$Ser vletInvocationAction.run(WebAppServletContext.java :3214)
    at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Se curityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.sec uredExecute(WebAppServletContext.java:1983)
    at weblogic.servlet.internal.WebAppServletContext.exe cute(WebAppServletContext.java:1890)
    at weblogic.servlet.internal.ServletRequestImpl.run(S ervletRequestImpl.java:1344)
    at weblogic.work.ExecuteThread.execute(ExecuteThread. java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java :181)


    I am very confused by this line from log:
    ERROR: 'This is not an attribute, it is a namespace:xmlns:ns'

    Thank you, Olexandr Kabanov

  • #2
    The SAAJ implementation provided by Weblogic 9 has some issues, namespace prefixes being one of them.

    To solve it, you can switch to the reference implementation from SUN. The FAQ explains how.

    Comment


    • #3
      Thank you for reply.

      I had downloaded sun jwsdp 1.1.
      I put SAAJ implementations (dom4j.jar, saaj-ri.jar ) to lib directory of echo.war.

      Lib directory does not include any SAAJ interfaces. So interfaces existed in weblogic, implementation is in echo.war.

      I pointed which implementation of SAAJ should be used:

      <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory">
      <property name="messageFactory">
      <bean class="com.sun.xml.messaging.saaj.soap.MessageFact oryImpl"/>
      </property>
      </bean>

      I think i have done all correct.
      I have got the follow:

      2110 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.ws.soap.
      server.SoapMessageDispatcher - Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.Pay loadEndpoint
      Adapter@1eb4d55]
      !!! ECHO. It is invoked !
      2125 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] TRACE org.springframework.core.Col
      lectionFactory - Creating [java.util.LinkedHashMap]
      ERROR: 'Cannot declare reserved xmlns prefix'
      2157 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.ws.soap.
      server.SoapMessageDispatcher - Testing endpoint exception resolver [org.springframework.ws.soap.server.endpoint.Simple S
      oapExceptionResolver@1222007]
      2157 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.ws.trans
      port.http.MessageDispatcherServlet - Could not complete request
      java.lang.UnsupportedOperationException: remove() is not supported by this iterator
      at org.dom4j.tree.SingleIterator.remove(SingleIterato r.java:43)
      at org.dom4j.tree.FilterIterator.remove(FilterIterato r.java:51)
      at org.springframework.ws.soap.saaj.Saaj11Implementat ion.removeContents(Saaj11Implementation.java:273)
      at org.springframework.ws.soap.saaj.SaajSoap11Body.ad dFault(SaajSoap11Body.java:53)
      at org.springframework.ws.soap.saaj.SaajSoap11Body.ad dServerOrReceiverFault(SaajSoap11Body.java:72)
      at org.springframework.ws.soap.server.endpoint.Simple SoapExceptionResolver.resolveExceptionInternal(Sim pleSoapEx
      ceptionResolver.java:35)
      at org.springframework.ws.server.endpoint.AbstractEnd pointExceptionResolver.resolveException(AbstractEn dpointExc
      eptionResolver.java:60)
      at org.springframework.ws.server.MessageDispatcher.pr ocessEndpointException(MessageDispatcher.java:291)
      at org.springframework.ws.server.MessageDispatcher.di spatch(MessageDispatcher.java:212)
      at org.springframework.ws.server.MessageDispatcher.re ceive(MessageDispatcher.java:145)
      at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMe
      ssageReceiverObjectSupport.java:84)
      at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceive
      rHandlerAdapter.java:56)

      Thank you, Alex

      Comment


      • #4
        You probably want to use a more recent version (i.e. SAAJ 1.2, or if you run on Java 5: SAAJ 1.3). I think JWDSP 1.6 shipped with SAAJ 1.2.2.

        Also, could you please use the [code] tags next time you include a stack trace, it makes them easier to read . Thanks

        Comment


        • #5
          OK, thank you.

          Yes, i use java 5.0 but i am afraid that it is impossible to use SAAJ 1.3 due as i understand from FAQ - Weblogic does not support SAAJ 1.3. So if i will add SAAJ 1.3 implementation to echo.war it will not work because SAAJ interfaces which included in weblogic are older.

          Please correct me if i am wrong, Alex

          Comment


          • #6
            Well, the built-in SAAJ version is 1.1. By overriding it, you can use SAAJ 1.3, though.

            Alternatively, you can use AXIOM, as indicated at http://static.springframework.org/sp...n.html#d0e1222

            Comment

            Working...
            X