Quick question in relation with this. It is possible to change the namespace of the objected passed as arguments to the webservices? Because we have the following service.xml:
<service name="BoxWebService" targetNamespace="http://zzz.yyy.xxx"> <description>Book sample service</description> <schema schemaNamespace="http://zzz.yyy.xxx/xsd" /> <parameter name="ServiceClass" locked="false"> org.my.webservice.MyService </parameter> <operation name="doUpload"> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </operation> </service> The method doUpload receives an object org.my.webservice.vo.MyDocument. I expected the WSDL to use the namespace http://zzz.yyy.xxx for the object MyDocument, but actually it is using the full package name to create the namespace: <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace=" http://vo.webservice.my.org/xsd"> <xs:complexType name="MyDocument"> <xs:sequence> <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> So the targetnamespace is not affecting the object MyDocument, only the messages and the service itself: <xs:schema xmlns:ax22="http://vo.webservice.my.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://zzz.yyy.xxx/xsd"> <xs:import namespace="http://vo.webservice.my.org/xsd"/> <xs:element name="doUpload"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="doc" nillable="true" type="ax21:MyDocument"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="doUploadResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="return" type="xs:boolean"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Is it possible to change the namespace of the object MyDocument? Thanks JL 2012/4/25 Kishanthan Thangarajah <kshanth2...@gmail.com> > Hi, > > On Fri, Apr 20, 2012 at 12:14 AM, Philippe A. <futhar...@gmail.com> wrote: > >> Hello, >> >> Can someone explain the purpose of the targetNamespace attribute in >> services.xml? >> >> My webservice namespace appears to be actually set by the ServiceClass >> parameter "project.webservices.svc.Class". If I set targetNamespace="bozo", >> then the wsdl will show <wsdl:definitions targetNamespace="bozo">. However, >> my client requests won't be accepted unless I set my target namespace to " >> http://svc.webservices.project". >> > > This attribute is used in setting the tagetNamespace for the service. If > this is not set, it will be calculated form the package name. If you have > your own WSDL file in the service archive, then this attribute can be used > in overriding the targetNamespace value in that wsdl file. But if you want > to have a custom target namespace for the requests then you can make use of > the schema element that can be defined in services.xml. You can get more > info from this tutorial [1] on this. > > Thanks, > Kishanthan. > [1] http://wso2.org/library/2060 > >> >> Thanks, >> >> -- >> Philippe >> >> >