SOAP Deserialize Error - trying to invoke Java Service

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SOAP Deserialize Error - trying to invoke Java Service

fmisa
Hi OfBiz Developers...

I'm new to OfBiz - evaluating...
I working with Trunk/SVN checkout...
http://svn.apache.org/repos/asf/ofbiz/trunk

Would like to make some calls on Java Service - via a SOAP or XML-RPC client.

The online documentation, tutorials and forum are unclear on how best to invoke a Java method from client (wishing to bypass the OfBiz UI component "screens" hierarchy)

I've been able to externalize by custom service - by adding export to service definition:
engine="java"  export="true"

This auto-generates a WSDL for my service - available from here:
https://localhost:8443/webtools/control/SOAPService?wsdl

However, when I hit my service - using SOAP call - auto-generated from this WSDL definition - I'm getting all sorts of SOAP XML deserialize errors.... right at:

line 424 (Trunk) XmlSerializer >> Node tempNode = mapKeyElement.getFirstChild();

NullPointerException - because mapKeyElement is NULL from previous
line: 422: Element mapKeyElement = UtilXml.firstChildElement(curElement, "map-Key");

The data/elements it's looking for "map-Key" etc. all seem to be there - not sure why I'm getting a NullPointer here - here's a snapshot of the actual XML message being sent:
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <SOAP-ENV:Body>
        <jsx1:testServiceTest xmlns:jsx1="http://ofbiz.apache.org/service/" >
            <map-Map>
                <jsx1:map-Entry>
                    <jsx1:map-Key>
                        <jsx1:std-String>testAttrib1String</jsx1:std-String>
                    </jsx1:map-Key>

                    <jsx1:map-Value>
                        <jsx1:std-String>testKey1</jsx1:std-String>
                    </jsx1:map-Value>
                </jsx1:map-Entry>
                <jsx1:map-Entry>
                    <jsx1:map-Key>
                        <jsx1:std-String>testAttrib2String</jsx1:std-String>
                    </jsx1:map-Key>
                    <jsx1:map-Value>
                        <jsx1:std-String>testValue1</jsx1:std-String>
                    </jsx1:map-Value>
                </jsx1:map-Entry>
            </map-Map>
        </jsx1:testServiceTest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

So - I backed up - and decided to work with the OfBiz "Ping" service... just to test...
From the OfBiz - ServiceReference List - I can schedule a "Ping" job - and it runs successfully see the attached "workingPing.sqd.jpg" file for sequence...



However, I'm not able to call the "Ping" service via a SOAP call - same error I get with my custom service.
Why is the SOAPHandler failing to process the request message XML ?....
Shouldn't the SOAPHandler delegegate to JavaEventHandler given my service engine type ?

Why wouldn't the following SOAP call - be processed by the Ping service ?

Request:
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <SOAP-ENV:Body>
        <jsx1:ping xmlns:jsx1="http://ofbiz.apache.org/service/" >
            <map-Map>
                <jsx1:map-Entry>
                    <jsx1:map-Key>
                        <jsx1:std-String value="message" />
                    </jsx1:map-Key>
                    <jsx1:map-Value>
                        <jsx1:null />
                        <jsx1:std-String value="PING_TEST_BOOYAH" />
                    </jsx1:map-Value>
                </jsx1:map-Entry>
            </map-Map>
        </jsx1:ping>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Response:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
    <soapenv:Body>
        <pingResponse xmlns="http://ofbiz.apache.org/service/" >
            <map-Map>
                <map-Entry>
                    <map-Key>
                        <std-String value="responseMessage" >
                        </std-String>
                    </map-Key>

                    <map-Value>
                        <std-String value="error" >
                        </std-String>
                    </map-Value>
                </map-Entry>
            </map-Map>
        </pingResponse>
    </soapenv:Body>
</soapenv:Envelope>


Same error - as my custom service:
[java] ---- runtime exception report --------------------------------------------------
[java] Exception: java.lang.NullPointerException
[java] Message: null
[java] ---- stack trace ---------------------------------------------------------------
[java] java.lang.NullPointerException
[java] org.ofbiz.entity.serialize.XmlSerializer.deserializeSingle(XmlSerializer.java:424)
[java] org.ofbiz.entity.serialize.XmlSerializer.deserialize(XmlSerializer.java:128)
[java] org.ofbiz.service.engine.SoapSerializer.deserialize(SoapSerializer.java:45)
[java] org.ofbiz.webapp.event.SOAPEventHandler.invoke(SOAPEventHandler.java:177)
[java] org.ofbiz.webapp.control.RequestHandler.runEvent(RequestHandler.java:666)
[java] org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:409)
[java] org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:214)
[java] org.ofbiz.webapp.control.ControlServlet.doPost(ControlServlet.java:86)
[java] javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
[java] javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
[java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
[java] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
[java] org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:318)
[java] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
[java] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
[java] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
[java] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
[java] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
[java] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
[java] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
[java] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
[java] org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
[java] org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
[java] org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
[java] org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
[java] org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
[java] java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[java] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[java] java.lang.Thread.run(Thread.java:662)


Should I be using XML-RPC instead ?  I cannot find a single example of tutorial that walks you through an XML-RPC example.
See the "failingPing.sqd.jpg" for sequence taken by app - when invoking from my SOAP client...
Hope someone here - can help me understand what I'm doing wrong...
Thanks
Frank
Reply | Threaded
Open this post in threaded view
|

Re: SOAP Deserialize Error - trying to invoke Java Service

fmisa
This post was updated on .
Resolved here - workaround:
http://ofbiz.135035.n4.nabble.com/SOAP-service-in-ofbiz-fails-tt4636257.html

>>public static Element firstChildElement(Element element, String childElementName) {
Change from:
LINE: 808 childElementName.equals(node.getNodeName()
Change to:
LINE: 808 childElementName.equals(node.getLocalName()

Resolved the issue...

Thanks Jacques !
https://issues.apache.org/jira/browse/OFBIZ-4441