473,719 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
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.SA XException: 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 "SAXExcepti on: 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 2388

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

Similar topics

3
2701
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 1.1), some methods work, some don't. The error message I got is "org.apache.axis.types.URI$MalformedURIException: No scheme found in URI..."
4
6316
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 2 strings <wsdl:portType name=SecurityLoginService"> <wsdl:operation name="login"> <wsdl:input message="tns:loginRequest" name="loginRequest"/> <wsdl:output message="tns:loginResponse" name="loginResponse"/> </wsdl:operation> </wsdl:portType>
3
9795
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 response. As a result of seraching news groups I guessed that the SOAP response defines an array element in a way that causes the dotnet deserialization routines to put the content in a generic object array (object) BUT the content is supposed to...
1
3746
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 that accesses a Axis provided web service. The client uses the code generated, using wsdl.exe, from the wsdl file provided by the web service provider. The web response has the following schema (roughly):
1
2827
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 session Id, is null, after deserializing, but when the XML passing over wire is seen, I can see the session Id being returned. But if in the client proxy code, if I changed the "Use" property from Literal to Encoded, .Net client is able to...
4
12307
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 .wsdl file they sent me. Now a problem turns up with a date field they implemented as xsd:dateTime, even though it only contains a date.
0
4530
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 return NULL. I used proxytrace to check the data that goes back and forward. I can see my request and response. See below at the bottom. I believe that this error occurs because of a problem .Net has in reading my doc/literal WSDL. Or my Axis...
2
1840
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 from the vendor is sending the right SOAP response and it is logged by the vendor. What have I tried so far to resolve: First i was creating the proxy using VS.NET's Web Reference. I tried to create the proxy using WSDL.exe and our vendor's raw...
2
6962
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 attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
0
8725
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9208
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9123
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9053
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4481
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4744
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2124
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.