• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1359
  • Last Modified:

problem perl SOAP::Lite 0.71 client with java JAX-WS 2.1.2 server

Hi,
 
  I am creating and using web services for long. Until now I created java and php service clients and server, but now I had to create a client in perl to maintain relationship betweend the old perl system with a new java system. The java and php servers and clients wrok without any problem, but I am unable to make perl client work.

The perl client is very simple, the code is attached. The server works fine with java client. The perl and java generated requests are quite similar. The mentionable difference in namespaces. The perl client calls the procedure but parameters looks not received properly by the server and it causes null pointer exception because of lack of parameters. It drives me crazy. Do you have any ide what is the cause and how to solve it?















Service WSDL:

<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.2-b05-RC1. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.2-b05-RC1. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://osszead.test.fooly.hu/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://osszead.test.fooly.hu/" name="OsszeadService">
<types>
<xsd:schema>
<xsd:import namespace="http://osszead.test.fooly.hu/" schemaLocation="http://127.0.0.1:8080/TestWS001/OsszeadService?xsd=1"></xsd:import>
</xsd:schema>
</types>
<message name="plusz">
<part name="parameters" element="tns:plusz"></part>
</message>
<message name="pluszResponse">
<part name="parameters" element="tns:pluszResponse"></part>
</message>
<portType name="Osszead">
<operation name="plusz">
<input message="tns:plusz"></input>
<output message="tns:pluszResponse"></output>
</operation>
</portType>
<binding name="OsszeadPortBinding" type="tns:Osszead">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<operation name="plusz">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="OsszeadService">
<port name="OsszeadPort" binding="tns:OsszeadPortBinding">
<soap:address location="http://127.0.0.1:8080/TestWS001/OsszeadService"></soap:address>
</port>
</service>
</definitions>

Open in new window

perl client trace:

[root@bck ~]# ./soaptest01.pl
SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::HTTP::Client::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: plusz SOAP::Data=HASH(0x9091248) SOAP::Data=HASH(0x90912f0)
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x90995bc)
SOAP::Transport::HTTP::Client::send_receive: POST http://127.0.0.1:8080/TestWS001/OsszeadService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 507
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://osszead.test.fooly.hu/#plusz"

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <plusz xmlns="http://osszead.test.fooly.hu/">
      <arg0>1</arg0>

      <arg1>2</arg1>
    </plusz>
  </soap:Body>
</soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x945b094)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Connection: close
Date: Sun, 15 Aug 2010 11:05:30 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Client-Date: Sun, 15 Aug 2010 11:05:30 GMT
Client-Peer: 127.0.0.1:8080
Client-Response-Num: 1

<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:Fault xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns3="http://www.w3.org/2003/05/soap-envelope"><faultcode>ns2:Server</faultcode><faultstring>java.lang.NullPointerException</faultstring><detail><ns2:exception xmlns:ns2="http://jax-ws.dev.java.net/" class="java.lang.NullPointerException" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false"><ns2:stackTrace><ns2:frame class="hu.fooly.test.osszead.Osszead" file="Osszead.java" line="28" method="plusz"/><ns2:frame class="sun.reflect.GeneratedMethodAccessor989" line="unknown" method="invoke"/><ns2:frame class="sun.reflect.DelegatingMethodAccessorImpl" file="DelegatingMethodAccessorImpl.java" line="25" method="invoke"/><ns2:frame class="java.lang.reflect.Method" file="Method.java" line="597" method="invoke"/><ns2:frame class="com.sun.xml.ws.api.server.InstanceResolver$1" file="InstanceResolver.java" line="246" method="invoke"/><ns2:frame class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java" line="146" method="invoke"/><ns2:frame class="com.sun.xml.ws.server.sei.EndpointMethodHandler" file="EndpointMethodHandler.java" line="257" method="invoke"/><ns2:frame class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java" line="93" method="processRequest"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="595" method="__doRun"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="554" method="_doRun"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="539" method="doRun"/><ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="436" method="runSync"/><ns2:frame class="com.sun.xml.ws.server.WSEndpointImpl$2" file="WSEndpointImpl.java" line="243" method="process"/><ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit" file="HttpAdapter.java" line="444" method="handle"/><ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter" file="HttpAdapter.java" line="244" method="handle"/><ns2:frame class="com.sun.xml.ws.transport.http.servlet.ServletAdapter" file="ServletAdapter.java" line="135" method="handle"/><ns2:frame class="com.sun.xml.ws.transport.http.servlet.WSServletDelegate" file="WSServletDelegate.java" line="129" method="doGet"/><ns2:frame class="com.sun.xml.ws.transport.http.servlet.WSServletDelegate" file="WSServletDelegate.java" line="160" method="doPost"/><ns2:frame class="com.sun.xml.ws.transport.http.servlet.WSServlet" file="WSServlet.java" line="75" method="doPost"/><ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="710" method="service"/><ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="803" method="service"/><ns2:frame class="org.apache.catalina.core.ApplicationFilterChain" file="ApplicationFilterChain.java" line="290" method="internalDoFilter"/><ns2:frame class="org.apache.catalina.core.ApplicationFilterChain" file="ApplicationFilterChain.java" line="206" method="doFilter"/><ns2:frame class="org.apache.catalina.core.StandardWrapperValve" file="StandardWrapperValve.java" line="233" method="invoke"/><ns2:frame class="org.apache.catalina.core.StandardContextValve" file="StandardContextValve.java" line="175" method="invoke"/><ns2:frame class="org.apache.catalina.core.StandardHostValve" file="StandardHostValve.java" line="128" method="invoke"/><ns2:frame class="org.apache.catalina.valves.ErrorReportValve" file="ErrorReportValve.java" line="102" method="invoke"/><ns2:frame class="org.apache.catalina.core.StandardEngineValve" file="StandardEngineValve.java" line="109" method="invoke"/><ns2:frame class="org.apache.catalina.connector.CoyoteAdapter" file="CoyoteAdapter.java" line="286" method="service"/><ns2:frame class="org.apache.coyote.http11.Http11Processor" file="Http11Processor.java" line="844" method="process"/><ns2:frame class="org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler" file="Http11Protocol.java" line="583" method="process"/><ns2:frame class="org.apache.tomcat.util.net.JIoEndpoint$Worker" file="JIoEndpoint.java" line="447" method="run"/><ns2:frame class="java.lang.Thread" file="Thread.java" line="619" method="run"/></ns2:stackTrace></ns2:exception></detail></ns2:Fault></S:Body></S:Envelope>
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
SOAP::SOM::DESTROY: ()
SOAP::Lite::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Parser::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Transport::HTTP::Client::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
[root@bck ~]#

Open in new window

Java client request and response:

POST /TestWS001/OsszeadService HTTP/1.1
Content-type: text/xml;charset=utf-8
Soapaction: ""
Accept: text/xml, multipart/related
User-Agent: JAX-WS RI 2.2-hudson-752-
Cache-Control: no-cache
Pragma: no-cache
Host: 127.0.0.1:28181
Connection: keep-alive
Content-Length: 226

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:plusz xmlns:ns2="http://osszead.test.fooly.hu/"><arg0>8</arg0><arg1>91</arg1></ns2:plusz></S:Body></S:Envelope>

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Fri, 13 Aug 2010 11:49:52 GMT

d8
<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:pluszResponse xmlns:ns2="http://osszead.test.fooly.hu/"><return>99</return></ns2:pluszResponse></S:Body></S:Envelope>
0

Open in new window

#!/usr/bin/perl -w
use utf8;
use strict;

use SOAP::Lite +trace => 'all';

my $host  = 'http://127.0.0.1:8080';
my $uri   = 'http://osszead.test.fooly.hu/';
my $proxy = $host . '/TestWS001/OsszeadService';




my $soap = SOAP::Lite->uri($uri)->proxy($proxy);
$soap->readable(1);

print $soap->call('plusz', SOAP::Data->name("arg0")->value(1)->type(''),SOAP::Data->name("arg1")->value(2)->type('') )->result;

Open in new window

0
fooly
Asked:
fooly
  • 2
1 Solution
 
kawasCommented:
your only difference is that plusz is not prefixed, <plusz xmlns="http://osszead.test.fooly.hu/"> [perl]
 versus <ns2:plusz xmlns:ns2="http://osszead.test.fooly.hu/"> [java]

This is a known bug in java sax parsers: http://search.cpan.org/~mkutter/SOAP-Lite-0.712/lib/SOAP/Lite.pm#Java

I think that you could prefix the element if you create a custom soap serializer.
0
 
kawasCommented:
my $soap = SOAP::Lite->uri($uri)->proxy($proxy);
$soap->ns('http://osszead.test.fooly.hu/', 'ns2'); # this might do the trick ...
$soap->readable(1);
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now