472,358 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 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,


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>
  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>
  15.     <servlet-mapping>
  16.         <servlet-name>axis</servlet-name>
  17.         <url-pattern>/servlet/AxisServlet</url-pattern>
  18.     </servlet-mapping>
  20.     <servlet-mapping>
  21.         <servlet-name>axis</servlet-name>
  22.         <url-pattern>*.jws</url-pattern>
  23.     </servlet-mapping>
  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"/>
  12.         <requestFlow>
  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>
  22.     <handler name="acegiAuthenticationHandler" type="java:{our}.AcegiAuthenticationHandler"/>
  23.         </requestFlow>
  25.     <responseFlow>
  26.         <handler name="OutgoingSOAPMessageViewer" type="java:{our}.OutgoingSOAPMessageViewer"/>
  27.     </responseFlow>
  28.     </globalConfiguration>
  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"/>
  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>
  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>
  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>

Tracey Annison
Jul 13 '07 #1
0 2249

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

Similar topics

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...
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...
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...
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...
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...
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...
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...
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...
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...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.