Thanks for the tip! I tried it and, with some minor additional changes
(it seems like there's a problem with the data objects used in the
method being part of a different Java package than the service class
itself), it works.
Again, many thanks!
Kjell Normann
[EMAIL PROTECTED] wrote:
I'm a relative newbie to AXIS2 but have been struggling with the same
issues between generating/creating the WSDL and how the services.xml
file affects it. This worked for me.
Try to add this element:
...
</messageReceivers>
<schema schemaNamespace="http://<your targetNamespace>/xsd"/>
<parameter name="ServiceClass">
...
This may also be necessary, but again not an expert here, add the
targetNamespace attribute to the service:
<service name="CurrentTimeService" scope="application">
targetNamespace="http://<your targetNamespace>/">
They impact the wsdl generation.
Regards,
Ken
-----Original Message-----
From: Kjell V. Normann [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 24, 2007 8:05 AM
To: [email protected]
Subject: Namespace problems with a POJO based Axis2 web service and
generated WSDL
Hi.
I've created a WS using the following POJO:
package no.mazeppa.kda.ws;
public class CurrentTimeService
{
...
public ResultSpec[] sendHours(CurrentHourSpec[] data) throws
BaanException
{
...
}
}
My services.xml looks like this:
<serviceGroup>
<service name="CurrentTimeService" scope="application">
<description>KDA Current Time Service</description>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</messageReceivers>
<parameter name="ServiceClass">
no.mazeppa.kda.ws.CurrentTimeService
</parameter>
</service>
</serviceGroup>
I've generated a WSDL file using the java2wsdl Eclipse plugin (I've also
tried the command line tool). See the WSDL at the end of this mail.
The WSDL file is then used to generate a Web Service Control in BEA
Weblogic (8.1SP6). When I try to call the WS using this control, I get
the following error message:
External Service Failure: Did not find expected root element
[EMAIL PROTECTED]://ws.kda.mazeppa.no/xsd: actual document
contained {http://org.apache.axis2/xsd}sendHoursResponse
I've used SOAPMonitor to look at the response from the WS and it looks
like this:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header />
<soapenv:Body>
<ns:sendHoursResponse xmlns:ns="http://org.apache.axis2/xsd">
<ns:return>
<ns:id>id1</ns:id>
<ns:resultText>Result!</ns:resultText>
<ns:status>OK</ns:status>
</ns:return>
</ns:sendHoursResponse>
</soapenv:Body>
</soapenv:Envelope>
I guess the problem is the xmlns:ns="http://org.apache.axis2/xsd"
attribute on the ns:sendHoursResponse element which doesn't match the
targetNamespace="http://ws.kda.mazeppa.no/xsd" attribute on the
xs:schema element in the WSDL.
Why is there a mismatch between the generated WSDL and the response from
the WS? Is there any way to work around this problem?
Any help would be greatly appreciated.
Regards,
Kjell Normann
--------------------------------
<wsdl:definitions xmlns:axis2="http://ws.kda.mazeppa.no"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ns="http://ws.kda.mazeppa.no/xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://ws.kda.mazeppa.no">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns0="http://data.ws.kda.mazeppa.no/xsd"
attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://ws.kda.mazeppa.no/xsd">
<xs:element name="sendHoursFault">
<xs:complexType>
<xs:sequence>
<xs:element name="sendHoursFault"
type="xs:anyType" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sendHours">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="data"
nillable="true" type="ns0:CurrentHourSpec"
/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sendHoursResponse">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="return"
nillable="true" type="ns0:ResultSpec" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ax21="http://data.ws.kda.mazeppa.no/xsd"
attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://data.ws.kda.mazeppa.no/xsd">
<xs:element name="CurrentHourSpec"
type="ax21:CurrentHourSpec" />
<xs:complexType name="CurrentHourSpec">
<xs:sequence>
<xs:element name="activity" nillable="true"
type="xs:string" />
<xs:element name="company" type="xs:int" />
<xs:element name="employee" nillable="true"
type="xs:string" />
<xs:element name="hoursWorked1" type="xs:float" />
<xs:element name="hoursWorked2" type="xs:float" />
<xs:element name="hoursWorked3" type="xs:float" />
<xs:element name="hoursWorked4" type="xs:float" />
<xs:element name="hoursWorked5" type="xs:float" />
<xs:element name="hoursWorked6" type="xs:float" />
<xs:element name="hoursWorked7" type="xs:float" />
<xs:element name="id" nillable="true"
type="xs:string" />
<xs:element name="period" type="xs:int" />
<xs:element name="project" nillable="true"
type="xs:string" />
<xs:element name="task" type="xs:int" />
<xs:element name="year" type="xs:int" />
</xs:sequence>
</xs:complexType>
<xs:element name="ResultSpec" type="ax21:ResultSpec" />
<xs:complexType name="ResultSpec">
<xs:sequence>
<xs:element name="id" nillable="true"
type="xs:string" />
<xs:element name="resultText" nillable="true"
type="xs:string" />
<xs:element name="status" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="sendHoursMessage">
<wsdl:part name="part1" element="ns:sendHours" />
</wsdl:message>
<wsdl:message name="sendHoursResponseMessage">
<wsdl:part name="part1" element="ns:sendHoursResponse" />
</wsdl:message>
<wsdl:message name="sendHoursFault">
<wsdl:part name="part1" element="ns:sendHoursFault" />
</wsdl:message>
<wsdl:portType name="CurrentTimeServicePortType">
<wsdl:operation name="sendHours">
<wsdl:input message="axis2:sendHoursMessage" />
<wsdl:output message="axis2:sendHoursResponseMessage" />
<wsdl:fault message="axis2:sendHoursFault"
name="sendHoursFault" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CurrentTimeServiceSOAP11Binding"
type="axis2:CurrentTimeServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="sendHours">
<soap:operation soapAction="urn:sendHours" style="document"
/>
<wsdl:input>
<soap:body use="literal"
namespace="http://ws.kda.mazeppa.no" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal"
namespace="http://ws.kda.mazeppa.no" />
</wsdl:output>
<wsdl:fault name="sendHoursFault">
<soap:body use="literal"
namespace="http://ws.kda.mazeppa.no" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="CurrentTimeServiceSOAP12Binding"
type="axis2:CurrentTimeServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="sendHours">
<soap12:operation soapAction="urn:sendHours"
style="document" />
<wsdl:input>
<soap12:body use="literal"
namespace="http://ws.kda.mazeppa.no" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"
namespace="http://ws.kda.mazeppa.no" />
</wsdl:output>
<wsdl:fault name="sendHoursFault">
<soap12:body use="literal"
namespace="http://ws.kda.mazeppa.no" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CurrentTimeService">
<wsdl:port name="CurrentTimeServiceSOAP11port"
binding="axis2:CurrentTimeServiceSOAP11Binding">
<soap:address
location="http://localhost:8080/axis2/services/CurrentTimeService" />
</wsdl:port>
<wsdl:port name="CurrentTimeServiceSOAP12port"
binding="axis2:CurrentTimeServiceSOAP12Binding">
<soap12:address
location="http://localhost:8080/axis2/services/CurrentTimeService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]