473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Behaviour of AXIS (with Spring and Java) in response to bad webservice calls

I wonder if you can help me - I'm new to this, and working in a project that has already been configured to work with Axis.

We have a Java project built with the Spring framework, in order to provide webservices for access via SOAP. As I understand it (ie not very well!) Axis works to accept these SOAP messages from the client and transform them into calls on our Java methods, and do the reverse with the responses - cool! Which is excellent, and it works well with the config files we have already set up.

But I have two problems/questions, which may well be related…

2) In trying to test what exactly happens in which case, I sent some test messages to the service, and found that I could send incorrect parameter names, and sometimes the service still gets called! Axis seems to match the data it recieves to the parameters of the method in some clever way that I don’t understand. Sometimes this works, sometimes it shows a type error. But it seems to depend what parameter I rename as to what exactly happens, so the results are (superficially, at least) unpredictable! I'm sure this behaviour is configurable in some way, but I can't seem to find out how this is done. I'd like to make it so that missing parameters are passed into the method as nulls (as is happening now), but that badly named, duplicated or extraneous parameters are refused, with a specific errormessage stating what the issue is. Similarly, I'd like to reply with an explanatory message if a parameter is passed wth an incorrect type, rather than just a message "org.xml.sax.SAXException: Bad types" that does not detail which parameter is problematic.

1) The client can receive a "500" response, with an "Internal Server Error" message, although I'm having trouble figuring out exactly when this happens. I'd like to be able to configure what message they receive, in order to give them more information about what they got wrong.

I just don't know where to start with this - I'm sure there must be ways of configuring all this!

As much info about an example of what I'm looking at as seems sensible follows. Please forgive me if I've used incorrect terminology somewhere! :)

Thanks a heap,
Tracey

======================

So, let's say I have a Java class called DiaryService, with a method called createDiary that takes the appropriate data and returns a confirmation/error message - it starts like this :
Expand|Select|Wrap|Line Numbers
  1.     public String createDiary(final String library,
  2.             final BigDecimal companyCode, final Date diaryDate,  final Date actionedDate, 
  3.     final String diaryMessage) throws RemoteException 
And another called GetDiary that returns a Diary as a SOAP bean which looks like this :
Expand|Select|Wrap|Line Numbers
  1.     public DiarySoapBean getDiary(final String library,
  2.             final BigDecimal companyCode, final Date diaryDate) throws RemoteException

Axis very helpfully lets me access the createDiary and getDiary, by sending XML messages like this example:
Expand|Select|Wrap|Line Numbers
  1. <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  2. <ns1:createDiary soapenc:root="1" xmlns:ns1="http://localhost:8080/morph_zta/services/DiaryService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  3. <library xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">ZRMORPHTA</library>
  4. <companyCode xsi:type="xsd:Decimal" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">1</companyCode>
  5. <diaryDate xsi:type="xsd:date" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">2007-01-01Z</diaryDate>
  6. <actionedDate xsi:type="xsd:date" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">2007-01-01Z</actionedDate>
  7. <diaryMessage xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"/>Blah blah blah</diaryMessage>
  8. </ns1:createDiary>
  9. </soapenv:Body>
If I rename a parameter, the service may get called, with some other data in that parameter or not, or may not get called at all and the user get a "SAXException: Bad types" error message. I would like it to return a message stating that the parameter is not expected.
If I duplicate a parameter, the first occurrence appears to be used, and the next ignored. I would like it to return a message saying tnat the extra parameter is not expected.
If I add gibberish parameters, I get a "No such operation" message. I would like to be able to tell which parameters are incorrect.



We have entries like this in web.xml:
Expand|Select|Wrap|Line Numbers
  1.     <listener>
  2.         <listener-class>
  3.             org.apache.axis.transport.http.AxisHTTPSessionListener
  4.     </listener-class>
  5.     </listener>
  6.  
  7.     <servlet>
  8.         <display-name>Apache-Axis Servlet</display-name>
  9.         <servlet-name>axis</servlet-name>
  10.         <servlet-class>
  11.             com.workingmouse.webservice.axis.SpringAxisServlet
  12.     </servlet-class>
  13.     </servlet>
  14.  
  15.     <servlet-mapping>
  16.         <servlet-name>axis</servlet-name>
  17.         <url-pattern>/servlet/AxisServlet</url-pattern>
  18.     </servlet-mapping>
  19.  
  20.     <servlet-mapping>
  21.         <servlet-name>axis</servlet-name>
  22.         <url-pattern>*.jws</url-pattern>
  23.     </servlet-mapping>
  24.  
  25.     <servlet-mapping>
  26.         <servlet-name>axis</servlet-name>
  27.         <url-pattern>/services/*</url-pattern>
  28.     </servlet-mapping>
And these bits in our server-config.wsdd :
Expand|Select|Wrap|Line Numbers
  1.     <!-- Global config options -->
  2.     <globalConfiguration>
  3.         <parameter name="adminPassword" value="admin"/>
  4.         <parameter name="attachments.Directory" value="./attachments"/>
  5.         <parameter name="attachments.implementation"
  6.                 value="org.apache.axis.attachments.AttachmentsImpl"/>
  7.         <parameter name="sendXsiTypes" value="true"/>
  8.         <parameter name="sendMultiRefs" value="true"/>
  9.         <parameter name="sendXMLDeclaration" value="true"/>
  10.         <parameter name="axis.sendMinimizedElements" value="true"/>
  11.  
  12.         <requestFlow>
  13.  
  14.             <handler type="java:org.apache.axis.handlers.JWSHandler">
  15.                 <parameter name="scope" value="session"/>
  16.             </handler>
  17.             <handler type="java:org.apache.axis.handlers.JWSHandler">
  18.                 <parameter name="scope" value="request"/>
  19.                 <parameter name="extension" value=".jwr"/>
  20.             </handler>
  21.  
  22.     <handler name="acegiAuthenticationHandler" type="java:{our}.AcegiAuthenticationHandler"/>
  23.         </requestFlow>
  24.  
  25.     <responseFlow>
  26.         <handler name="OutgoingSOAPMessageViewer" type="java:{our}.OutgoingSOAPMessageViewer"/>
  27.     </responseFlow>
  28.     </globalConfiguration>
  29.  
  30.     <!-- Handlers -->
  31.     <handler name="LocalResponder"
  32.             type="java:org.apache.axis.transport.local.LocalResponder"/>
  33.     <handler name="URLMapper"
  34.             type="java:org.apache.axis.handlers.http.URLMapper"/>
  35.     <handler name="Authenticate"
  36.             type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
  37.  
  38.     <!-- Axis services -->
  39.     <service name="AdminService" provider="java:MSG">
  40.         <parameter name="allowedMethods" value="AdminService"/>
  41.         <parameter name="enableRemoteAdmin" value="true"/>
  42.         <parameter name="className" value="org.apache.axis.utils.Admin"/>
  43.         <namespace>http://xml.apache.org/axis/wsdd/</namespace>
  44.     </service>
  45.     <service name="Version" provider="java:RPC">
  46.         <parameter name="allowedMethods" value="getVersion"/>
  47.         <parameter name="className" value="org.apache.axis.Version"/>
  48.     </service>
  49.  
  50.     <!-- Global config options -->
  51.     <transport name="http">
  52.         <requestFlow>
  53.             <handler type="URLMapper"/>
  54.             <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
  55.         </requestFlow>
  56.     </transport>
  57.     <transport name="local">
  58.         <responseFlow>
  59.             <handler type="LocalResponder"/>
  60.         </responseFlow>
  61.     </transport>
  62.  
  63.     <service name="DiaryServices" provider="Handler" style="rpc">
  64.         <parameter name="handlerClass" value="com.workingmouse.webservice.axis.SpringBeanRPCProvider"/>
  65.         <parameter name="springBean" value="diaryServices"/>
  66.         <parameter name="springBeanClass" value="uk.co.trisystems.morph.ta.diary.soap.DiaryService"/>
  67.         <parameter name="allowedMethods" value="createDiary getDiary"/>
  68.         <parameter name="scope" value="application"/>
  69.         <beanMapping qname="ns:diary" xmlns:ns="urn:DiaryService" languageSpecificType="java:uk.co.trisystems.morph.ta.diary.soap.DiarySoapBean"/>
  70.     </service>

Cheers
Tracey Annison
Jul 13 '07 #1
0 2335

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jacky Zhu | last post by:
Hi all, I am having a problem trying to consume a webservice that is developed on ..Net. I can access it without any problem using a .net client, but when I use a java client (based on Axis...
4
by: JLJ | last post by:
I have a very simple webservice written in Java/Axis. It takes in a complexType with 2 string elements, userid and password. The response is a complexType containing two complexTypes each having...
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
1
by: parrot toes | last post by:
I tried to post this question before, but there was an error when posting. I case it did get posted and in order to avoid duplication, I'll just repost a summary. I have written a dotnet client...
1
by: Parag Mahajan | last post by:
Hi, I am developing a .Net client for Axis 1.1 web service written in java. The wsdl is generated using, java2WSDL with these switches:: -y WRAPPED -u LITERAL The login service which returns a...
4
by: Lucvdv | last post by:
I have to connect to a server set up by the government, where they used Apache Axis to create a webservice. The code I use to interface to the webservice is generated by wsdl.exe, based on a...
0
by: karazy | last post by:
I have been reading all the forums and understand whats going wrong but am not sure how to fix it. I have written a basic doc/literal web service. But when it is called by a .net client it will...
2
by: zmbharmal | last post by:
I have a .NET client My vendor has a Axis/Java Webservice I am able to pass the parameters to their webmethod. They can read it. When they return a Response, it is coming as NULL. The webservice...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.