hbiz
asked on
php soap request problem
I have the following web service I'd like to communicate with using php soap:
http://www.animplant.com/rmb/rmbService?wsdl
with the following php code:
That code constantly catches a java.lang.NullPointerExcep tion from the service.
After some debugging, I found that my php soap object was not properly formatting the header as the service excepted and hence the null pointer issue.
I have access to this testing page to make sure that the service is working correctly:
http://www.animplant.com:8080/rmb/rmbService?Tester
if you plug in 0.2 in all of the fields of getResult and submit, you'll notice that it's working properly.
I was wondering if anyone could figure out what soap header format the getResult function requires and how I can get PHP to correctly pass that information to the service. I believe all the information can be deduced from the above code and links but let me know if you require more details.
Thanks for your time.
http://www.animplant.com/rmb/rmbService?wsdl
with the following php code:
<? php
$net = new SoapClient("http://www.animplant.com/rmb/rmbService?wsdl");
try{
$result=$net->__soapCall('getResult', array('network'=>'10', 'x1'=>0.2, 'y1'=>0.2, 'x2'=>0.2, 'y2'=>0.2,
'x3'=>0.2, 'y3'=>0.2, 'x3'=>0.2, 'y3'=>0.2,
'x4'=>0.2, 'y4'=>0.2, 'x5'=>0.2, 'y5'=>0.2,
'x6'=>0.2, 'y6'=>0.2, 'x7'=>0.2, 'y7'=>0.2,
'x8'=>0.2, 'y8'=>0.2, 'x9'=>0.2, 'y9'=>0.2,
'x10'=>0.2, 'y10'=>0.2, 'x11'=>0.2, 'y11'=>0.2,
'x12'=>0.2, 'y12'=>0.2, 'x13'=>0.2, 'y13'=>0.2,
'x14'=>0.2, 'y14'=>0.2
)
)
;
print_r($result);
}catch(Exception $e)
{
print_r($net->__getLastRequest());
}
?>
That code constantly catches a java.lang.NullPointerExcep
After some debugging, I found that my php soap object was not properly formatting the header as the service excepted and hence the null pointer issue.
I have access to this testing page to make sure that the service is working correctly:
http://www.animplant.com:8080/rmb/rmbService?Tester
if you plug in 0.2 in all of the fields of getResult and submit, you'll notice that it's working properly.
I was wondering if anyone could figure out what soap header format the getResult function requires and how I can get PHP to correctly pass that information to the service. I believe all the information can be deduced from the above code and links but let me know if you require more details.
Thanks for your time.
Could you post what you get from $net->__getLastRequest() ?
At http://www.animplant.com/rmb/ I see a JSP page with Hello World! As I look at it, it raises a few questions...
Can you please step back from the technical details and tell us what this is all about, in general business terms? There may be an easier way to skin this cat, if we know what kind of cat it is.
Is there some other way you can communicate with the service, like a RESTful interface? The online world is littered with failed SOAP requests, but I have never seen a REST interface that you could not understand and use immediately.
Can you please step back from the technical details and tell us what this is all about, in general business terms? There may be an easier way to skin this cat, if we know what kind of cat it is.
Is there some other way you can communicate with the service, like a RESTful interface? The online world is littered with failed SOAP requests, but I have never seen a REST interface that you could not understand and use immediately.
ASKER
Here's the result of my getLastRequest:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://rmb.animplant.com/"><SOAP-ENV:Bod y><ns1:get Result/><p aram1>0.2< /param1><p aram2>0.2< /param2><p aram3>0.2< /param3><p aram4>0.2< /param4><p aram5>0.2< /param5><p aram6>0.2< /param6><p aram7>0.2< /param7><p aram8>0.2< /param8><p aram9>0.2< /param9><p aram10>0.2 </param10> <param11>0 .2</param1 1><param12 >0.2</para m12><param 13>0.2</pa ram13><par am14>0.2</ param14><p aram15>0.2 </param15> <param16>0 .2</param1 6><param17 >0.2</para m17><param 18>0.2</pa ram18><par am19>0.2</ param19><p aram20>0.2 </param20> <param21>0 .2</param2 1><param22 >0.2</para m22><param 23>0.2</pa ram23><par am24>0.2</ param24><p aram25>0.2 </param25> <param26>0 .2</param2 6><param27 >0.2</para m27><param 28>0.2</pa ram28></SO AP-ENV:Bod y></SOAP-E NV:Envelop e>
I'm told by the webservice owner that it should be as follows:
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:getResult xmlns:ns2="http://rmb.animplant.com/
">
<x1>0.2</x1>
<y1>0.2</y1>
<x2>0.2</x2>
<y2>0.2</y2>
<x3>0.2</x3>
<y3>0.2</y3>
<x4>0.2</x4>
<y4>0.2</y4>
<x5>0.2</x5>
<y5>0.2</y5>
<x6>0.2</x6>
<y6>0.2</y6>
<x7>0.2</x7>
<y7>0.2</y7>
<x8>0.2</x8>
<y8>0.2</y8>
<x9>0.2</x9>
<y9>0.2</y9>
<x10>0.2</x10>
<y10>0.2</y10>
<x11>0.2</x11>
<y11>0.2</y11>
<x12>0.2</x12>
<y12>0.2</y12>
<x13>0.2</x13>
<y13>0.2</y13>
<x14>0.2</x14>
<y14>0.2</y14>
</ns2:getResult>
</S:Body>
</S:Envelope>
Any ideas how I can make php do that?
My guess is the soap _doRequest() function but I'm not sure of the specific details
thanks
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://rmb.animplant.com/"><SOAP-ENV:Bod
I'm told by the webservice owner that it should be as follows:
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:getResult xmlns:ns2="http://rmb.animplant.com/
">
<x1>0.2</x1>
<y1>0.2</y1>
<x2>0.2</x2>
<y2>0.2</y2>
<x3>0.2</x3>
<y3>0.2</y3>
<x4>0.2</x4>
<y4>0.2</y4>
<x5>0.2</x5>
<y5>0.2</y5>
<x6>0.2</x6>
<y6>0.2</y6>
<x7>0.2</x7>
<y7>0.2</y7>
<x8>0.2</x8>
<y8>0.2</y8>
<x9>0.2</x9>
<y9>0.2</y9>
<x10>0.2</x10>
<y10>0.2</y10>
<x11>0.2</x11>
<y11>0.2</y11>
<x12>0.2</x12>
<y12>0.2</y12>
<x13>0.2</x13>
<y13>0.2</y13>
<x14>0.2</x14>
<y14>0.2</y14>
</ns2:getResult>
</S:Body>
</S:Envelope>
Any ideas how I can make php do that?
My guess is the soap _doRequest() function but I'm not sure of the specific details
thanks
I went to this page and plugged in 0.2 in all the fields of the top form then clicked "getResult" and it did not look like it was working correctly. The code snippet contains the output after getResult. I got similar results with addTrainingData and getTrainingData.
<HTML><HEAD><TITLE>Method invocation trace</TITLE></HEAD><H2><A> getResult </A> Method invocation</H2><BR><HR><h4>Method parameter(s)</h4><table border="1"><tr><th>Type</th><th>Value</th></tr><tr><td>java.lang.String</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr><tr><td>java.lang.Float</td><td>0.2</td></tr></table><HR><H2>Service invocation threw an exception with message : null; Refer to the server log for more details</H2><BR><HR><HTML><HEAD><TITLE>Method invocation exception</TITLE></HEAD><H3>Exceptions details : java.lang.reflect.InvocationTargetException</H3><HR>javax.servlet.ServletException: java.lang.reflect.InvocationTargetException
at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doPost(WebServiceTesterServlet.java:326)
at org.glassfish.webservices.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:102)
at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:239)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doPost(WebServiceTesterServlet.java:297)
... 28 more
Caused by: javax.xml.ws.soap.SOAPFaultException: java.lang.NullPointerException
at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:189)
at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:130)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:140)
at $Proxy274.getResult(Unknown Source)
... 33 more
Caused by: java.lang.NullPointerException
at com.animplant.rmb.rmb.getResult(rmb.java:134)
at sun.reflect.GeneratedMethodAccessor449.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.glassfish.webservices.InstanceResolverImpl$1.invoke(InstanceResolverImpl.java:137)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
at org.glassfish.webservices.MonitoringPipe.process(MonitoringPipe.java:138)
at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:195)
at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:127)
at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:519)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:288)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143)
at org.glassfish.webservices.JAXWSServlet.doPost(JAXWSServlet.java:149)
... 26 more
<HR></HTML>
ASKER
Oops, my mistake, the first parameter to getResult should be the number 10 and the rest can be all 0.2
OK, let's try this again:
Can you please step back from the technical details and tell us what this is all about, in general business terms?
Thank you, ~Ray
Can you please step back from the technical details and tell us what this is all about, in general business terms?
Thank you, ~Ray
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is the solution provided by the service provider.