• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with perl web services and java client

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hii all
I am new to web services.I have tried one example from net .I have this perl module.


this is my cgi script




I am using this on Apache server 2.0 .I am using Active Perl and soap lite.When I access this service from perl based client i am getting the response.But when i try to access the web service from java client. I am getting this exception


Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: Denied access to method (echo) in class (main) at C:/Perl/site/lib
/SOAP/Lite.pm line 2159.

faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace enied access to method (echo) i
n class (main) at C:/Perl/site/lib/SOAP/Lite.pm line 2159.


my java client is



Please help me .Thanks in advance


-----
Nidhi Sharma
Pobody is nerfect
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

How to Get Help with SOAP web services.

A comparison between the (successful) SOAP request sent by the Perl client and the (failed) SOAP request sent by the Java client would help matters significantly.
 
nidhi sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much .Sorry but i dont know how to write or generate wsdl for my perl webservice.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by nidhi sharma:
Thanks so much .Sorry but i dont know how to write or generate wsdl for my perl webservice.



You can still do this:


Show sample request and responses from the client intercepted with Apache TCPMon (Tutorial) or java.net tcpmon. Don't forget to include the HTTP version, headers and response code. This shows the request that client generates and the response that the service emits. This information is necessary as it establishes the context of any Java exception which in many cases is an XML parsing error on either the service or the client side.

 
nidhi sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my XML request is



this i got from tcpmon.I still dnt know wats wrong with this
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK - so this is the request from the Java (Axis 1.4) Client.



It looks like a RPC/encoded request to the "echo" method passing a single string parameter.

Now where is the request from the working Perl client (for comparison)?
[ November 27, 2008: Message edited by: Peer Reynders ]
 
nidhi sharma
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am so sorry for my unformatted code
request from perl client is


[ November 27, 2008: Message edited by: nidhi sharma ]
[ November 27, 2008: Message edited by: nidhi sharma ]
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That has always been the problem with RPC/encoded - everybody had their own interpretation which never worked with anyone else - this is why current generation web service stacks do not support it.

Problems:
  • Java method name is "echo" - Perl expects "{urn:Echo}echo"
  • Java argument name is "arg0" - Perl expects "whatToEcho" (whether or not that is relevant depends on the Perl SOAP implementation)
  • Java argument type is "{http://schemas.xmlsoap.org/soap/encoding/}string" - Perl expects "{http://www.w3.org/2001/XMLSchema}string"


  • With all the fiddling that you would have to do to coerce the Axis 1.4 code to work I'd be tempted to switch to SAAJ instead (it is part of Java SE 6 but can be installed for J2SE 1.4 and Java SE 5) and simply build an equivalent SOAP request to the one the Perl client is generating.

    See What is the simplest possible Java client for a web service?
    James Clark: XML Namespaces

    Changing this line may get you past your current problem - but it suspect that it will be replaced by another.

    [ November 27, 2008: Message edited by: Peer Reynders ]
     
    nidhi sharma
    Greenhorn
    Posts: 5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks so much .Its working now.But why it is so??Is this Encoding problem used by axis.I am using a ddition web services .when I passed string arguments ,Its working fine.But i used it for integers .Integer are encoded in some parameters and i am getting error.I dont want to use SAAJ.Bcos creating soap messages is problem and i dont know much about that.What to do in that case???
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by nidhi sharma:
    Is this Encoding problem used by axis.



    No. The root of the problem is the RPC/encoding messaging mode and I actually suspect that SOAP:Lite's implementation is less mature than the Axis 1.x implementation.

    State of the SOAP


    It should consider severing itself from XML::RPC which is really a different protocol that operates under a totally different set of assumptions. SOAP::Lite should shift to a document-driven model, as opposed to an RPC driven one.
    ...
    SOAP::Lite should be built from the ground up to conform to the WS-i's requirements. It should be built first and foremost around a wicked WSDL parser and engine.
    ...
    What we endeavor to do is make SOAP::Lite easier to grok and easier to work with. What we hope to create is a new module, called SOAP::Easy.



    Bottomline: SOAP:Lite is hopelessly outdated in the current SOAP web service environment. Current SOAP web service stacks have abandoned RPC/encoded with its SOAP encoding because it was always difficult to get two different web service stacks to talk to one another for all but the most basic communication. It's obvious that you fully intend to use it as a pure RPC mechanism. If that is your intention then you may want to stick with XML-RPC (Getting started with XML-RPC in Perl, XML-RPC in Java programming, Apache XML-RPC)

    SOAP web services have (unsuccessfully) tried to move away from the RPC paradigm and currently strongly favor the document/literal messaging mode (including the wrapped document/literal convention which ironically made things more RPC again).

    I dont want to use SAAJ.


    SAAJ gives you the most control over your SOAP messages, especially when using RPC/encoded and in the absense of a WSDL. So if you insist on using SOAP:Lite on the server side and wish to access it from Java then SAAJ is your best choice ("Java Web Services in a Nutshell" Sample: Chapter 3 SAAJ (PDF)).

    Bcos creating soap messages is problem


    Welcome to the world of SOAP web services. As a SOAP web service developer you are expected to understand XML, XML Schema, SOAP and WSDL in depth - don't let the plethora of WS tools fool you. In your case the absence of a WSDL is a problem. Clients want a WSDL so that they can use their tools to generate a client stub (i.e. so that they do not have to build the SOAP messages from scratch). But wait - your clients may be using up to date web service stacks which only support the literal encoding style, so they can't access your web service even if you hand-craft a WSDL because your web service uses the RPC/encoded messaging mode!

    Look here for a simple example of the current basic development environment for web services under Java SE 6.

    Fact is SOAP web services and its extension protocols (collectively referred to as WS-* (sarcastically "Deathstar") ) have become so complex that Perl and Ruby seem have given up on them altogether. Those environments now tend to stick with XML-over-HTTP or RESTful HTTP web services.

    Developing RESTful Web Services in Perl
    reply
      Bookmark Topic Watch Topic
    • New Topic