Hi,

I've been developing an Axis based Webservice for some time now. Right now I'm at the point where the basics function alright and that I am starting on improving stuff like security. One aspect of that is stop using the generated WSDL and supply my own. Because I'm far from a WS guru, I decided to use the generated WSDL and use that as a basis for improvement.

What I've done is the following:
- Save generated WSDL with the same name as the service name (name.wsdl) and put that in the .aar (META-INF dir) - Set the parameter "useOriginalwsdl" to true for that service (services.xml)
- Keep the classes exactly the same, no other changes.
- Deploy the .aar, restart Tomcat.
- Verify webservice+operations using the listServices servlet (they are listed exactly as they should)

So Axis2 accepts the .aar.

However, now my webservices test client does not function anymore with this modification. This probably has to do with namespaces, but I wonder how I should get it working.
What must I change in my services.xml to get it working with my own WSDL?

**** *The java classes are in the root package /nl.organization.webservices/.*

*** services.xml snippet:*
<serviceGroup>
   <service name="Ws_Users">
       <description>WebServices - User Management</description>
<parameter name="ServiceClass" locked="true">nl.organization.webservices.Ws_Users</parameter>
       <parameter name="useOriginalwsdl">true</parameter>
       <operation name="addUser">
<messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
       </operation>
   </service>
<serviceGroup>

*** Generated WSDL snippet*:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:ns1="http://org.apache.axis2/xsd"; xmlns:ns="http://webservices.organization.nl"; xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:ax21="http://webservices.organization.nl/xsd"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; targetNamespace="http://webservices.organization.nl";>
   <wsdl:documentation>Ws_Users</wsdl:documentation>
   <wsdl:types>
<xs:schema xmlns:ax22="http://webservices.organization.nl/xsd"; attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservices.organization.nl";>
           <xs:import namespace="http://webservices.organization.nl/xsd"/>
           <xs:element name="addUser">
               <xs:complexType>
                   <xs:sequence>
<xs:element minOccurs="0" name="username" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="groupname" nillable="true" type="xs:string"/>
                   </xs:sequence>
               </xs:complexType>
           </xs:element>
           <xs:element name="addUserResponse">
               <xs:complexType>
                   <xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ax22:WsResponse"/>
                   </xs:sequence>
               </xs:complexType>
           </xs:element>
           ....
       </xs:schema>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservices.organization.nl/xsd";>
           <xs:complexType name="WsResponse">
               <xs:sequence>
<xs:element minOccurs="0" name="debugMessage" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="exitCode" type="xs:int"/> <xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
               </xs:sequence>
           </xs:complexType>
       </xs:schema>
   </wsdl:types>
   <wsdl:message name="addUserRequest">
       <wsdl:part name="parameters" element="ns:addUser"/>
   </wsdl:message>
   <wsdl:message name="addUserResponse">
       <wsdl:part name="parameters" element="ns:addUserResponse"/>
   </wsdl:message>
....

*** EXCEPTION WHEN RUNNING WS CLIENT:*
(I've generated the stub classes with wsdl2java)
Exception in thread "main" org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement debugMessage
   at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at nl.organization.webservices.Ws_UsersStub.fromOM(Ws_UsersStub.java:19397) at nl.organization.webservices.Ws_UsersStub.removeUser(Ws_UsersStub.java:1384)
   at test.Client.reqRemoveUser(Client.java:65)
   at test.Client.main(Client.java:14)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

Any help will be welcome!
Thanks!

Reply via email to