You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Brian J. Sayatovic" <tr...@trinition.org> on 2004/11/30 23:58:12 UTC
WSDL definitions targetNamespace vs. schema(s) targetNamespace
I'm trying to use the ?WSDL generating capabilities of Axis to generate
a WSDL Consumable by a non-Axis client, Laszlo. However is limited in
that it expects the targetNamespace of the schema to be the same as the
targetNamespace of the wsdl:definitions.
The wsdl:definitions targetNamespace appears to be the full path to my
service:
<wsdl:definitions
targetNamespace="http://localhost:8081/List/services/List" ...
However, my schema namespace isn't so simple. In fact, I have two
schemas for some reason. They are:
<wsdl:types>
<schema
targetNamespace="http://localhost:8081/List/services/List"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://localhost/List" />
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
</schema>
<schema targetNamespace="http://localhost/List"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ListKey">
<all>
<element name="value" type="xsd:string" />
</all>
</complexType>
<complexType name="ListOfThings">
<all>
<element name="key" type="impl:ListKey" />
</all>
</complexType>
</schema>
</wsdl:types>
In the interest of full disclosure, I had to create custom Serializers
because Laszlo also can't handle an xsd:sequence, so I'm using an
xsd:all for my complexTypes. Here's the writeSchema method for one of
my types:
public Element writeSchema(Class javaType, Types types) throws
Exception {
Element complexTypeElement = types.createElement("complexType");
complexTypeElement.setAttribute("name", "ListKey");
Element allElement = types.createElement("all");
complexTypeElement.appendChild(allElement);
Element elementElement = types.createElement("element");
elementElement.setAttribute("name", "value");
elementElement.setAttribute("type", "xsd:string");
allElement.appendChild(elementElement);
types.writeSchemaElement(ListManagerAxisDelegate.NAMESPACE,
complexTypeElement);
return complexTypeElement;
}
And elsewhere, I have ListManagerAxisDelegate.NAMESPACE set to be:
http://localhost:8081/List/services/List
So, I need to figure out who to get the targetNamespace of the schema
with my types to match the targetNamespace of my wsdl:definitions. The
thing is, I thought I took care of that by using the
writeSchemaElemnt... but that just ended up creatign an additional schema!
Any ideas?
Regards,
Brian.
Re: WSDL definitions targetNamespace vs. schema(s)
targetNamespace
Posted by to...@gsk.com.
Brian,
Thanks for sharing the solution. And for working it out yourself in the
first place!
Tony
"Brian J. Sayatovic" <tr...@trinition.org> wrote on 01/12/2004 02:45:45:
> I finally figured out how to set the targetNamespace of the wsdl:
> definitions. The WSDD services have parameters, one of which can be
> used to override the target namespace:
>
> <service ...>
> ...
> <parameter name="wsdlTargetNamespace"
value="http://localhost/List"/>
> ...
> </service>
>
> Regards,
> Brian.
>
> Brian J. Sayatovic wrote:
> I'm trying to use the ?WSDL generating capabilities of Axis to
> generate a WSDL Consumable by a non-Axis client, Laszlo. However is
> limited in that it expects the targetNamespace of the schema to be
> the same as the targetNamespace of the wsdl:definitions.
>
> The wsdl:definitions targetNamespace appears to be the full path to
> my service:
>
> <wsdl:definitions
targetNamespace="http://localhost:8081/List/services/List
> " ...
>
> However, my schema namespace isn't so simple. In fact, I have two
> schemas for some reason. They are:
>
> <wsdl:types>
> <schema
targetNamespace="http://localhost:8081/List/services/List"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://localhost/List" />
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"
/>
> </schema>
> <schema targetNamespace="http://localhost/List" xmlns="http:
> //www.w3.org/2001/XMLSchema">
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"
/>
> <complexType name="ListKey">
> <all>
> <element name="value" type="xsd:string" />
> </all>
> </complexType>
> <complexType name="ListOfThings">
> <all>
> <element name="key" type="impl:ListKey" />
> </all>
> </complexType>
> </schema>
> </wsdl:types>
>
> In the interest of full disclosure, I had to create custom
> Serializers because Laszlo also can't handle an xsd:sequence, so I'm
> using an xsd:all for my complexTypes. Here's the writeSchema method
> for one of my types:
>
> public Element writeSchema(Class javaType, Types types) throws
Exception {
> Element complexTypeElement = types.createElement("complexType");
> complexTypeElement.setAttribute("name", "ListKey");
> Element allElement = types.createElement("all");
> complexTypeElement.appendChild(allElement);
> Element elementElement = types.createElement("element");
> elementElement.setAttribute("name", "value");
> elementElement.setAttribute("type", "xsd:string");
> allElement.appendChild(elementElement);
>
> types.writeSchemaElement(ListManagerAxisDelegate.NAMESPACE,
> complexTypeElement);
>
> return complexTypeElement;
> }
>
> And elsewhere, I have ListManagerAxisDelegate.NAMESPACE set to be:
>
> http://localhost:8081/List/services/List
>
> So, I need to figure out who to get the targetNamespace of the
> schema with my types to match the targetNamespace of my wsdl:
> definitions. The thing is, I thought I took care of that by using
> the writeSchemaElemnt... but that just ended up creatign an
> additional schema!
>
> Any ideas?
>
> Regards,
> Brian.
>
>
Re: WSDL definitions targetNamespace vs. schema(s) targetNamespace
Posted by "Brian J. Sayatovic" <tr...@trinition.org>.
I finally figured out how to set the targetNamespace of the
wsdl:definitions. The WSDD services have parameters, one of which can
be used to override the target namespace:
<service ...>
...
<parameter name="wsdlTargetNamespace"
value="http://localhost/List"/>
...
</service>
Regards,
Brian.
Brian J. Sayatovic wrote:
> I'm trying to use the ?WSDL generating capabilities of Axis to
> generate a WSDL Consumable by a non-Axis client, Laszlo. However is
> limited in that it expects the targetNamespace of the schema to be the
> same as the targetNamespace of the wsdl:definitions.
>
> The wsdl:definitions targetNamespace appears to be the full path to my
> service:
>
> <wsdl:definitions
> targetNamespace="http://localhost:8081/List/services/List" ...
>
> However, my schema namespace isn't so simple. In fact, I have two
> schemas for some reason. They are:
>
> <wsdl:types>
> <schema
> targetNamespace="http://localhost:8081/List/services/List"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://localhost/List" />
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
>
> </schema>
> <schema targetNamespace="http://localhost/List"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
>
> <complexType name="ListKey">
> <all>
> <element name="value" type="xsd:string" />
> </all>
> </complexType>
> <complexType name="ListOfThings">
> <all>
> <element name="key" type="impl:ListKey" />
> </all>
> </complexType>
> </schema>
> </wsdl:types>
>
> In the interest of full disclosure, I had to create custom Serializers
> because Laszlo also can't handle an xsd:sequence, so I'm using an
> xsd:all for my complexTypes. Here's the writeSchema method for one of
> my types:
>
> public Element writeSchema(Class javaType, Types types) throws
> Exception {
> Element complexTypeElement = types.createElement("complexType");
> complexTypeElement.setAttribute("name", "ListKey");
> Element allElement = types.createElement("all");
> complexTypeElement.appendChild(allElement);
> Element elementElement = types.createElement("element");
> elementElement.setAttribute("name", "value");
> elementElement.setAttribute("type", "xsd:string");
> allElement.appendChild(elementElement);
>
> types.writeSchemaElement(ListManagerAxisDelegate.NAMESPACE,
> complexTypeElement);
>
> return complexTypeElement;
> }
>
> And elsewhere, I have ListManagerAxisDelegate.NAMESPACE set to be:
>
> http://localhost:8081/List/services/List
>
> So, I need to figure out who to get the targetNamespace of the schema
> with my types to match the targetNamespace of my wsdl:definitions.
> The thing is, I thought I took care of that by using the
> writeSchemaElemnt... but that just ended up creatign an additional schema!
>
>
> Any ideas?
>
> Regards,
> Brian.
>
>
>
Re: WSDL definitions targetNamespace vs. schema(s) targetNamespace
Posted by "Brian J. Sayatovic" <tr...@trinition.org>.
For what its worth, I figured out the source of the double schema.
Although my custom Serializers were coded to use a specific namespace, I
had not updated the namespace of the type mapping in the WSDD:
<typeMapping qname="list:ListKey" xmlns:list="http://localhost/List"
When generateWSDL gets called, it uses the methods defined in the class
beign puiblished RPC style to find the parameter types -- and for the
methods which had a ListKey parameter, it was using the typeMapping
which told it to use the shorter namespace. By changing the type mapping...
<typeMapping qname="list:ListKey"
xmlns:list="http://localhost:8081/List/services/List"
... to match what I had coded in my serializers, I was able to eliminate
the second name space and keep everything in the first.
I still would like to know how to change the target namespace of the
whole wsdl:definitions.
Regards,
Brian.
Brian J. Sayatovic wrote:
> I'm trying to use the ?WSDL generating capabilities of Axis to
> generate a WSDL Consumable by a non-Axis client, Laszlo. However is
> limited in that it expects the targetNamespace of the schema to be the
> same as the targetNamespace of the wsdl:definitions.
>
> The wsdl:definitions targetNamespace appears to be the full path to my
> service:
>
> <wsdl:definitions
> targetNamespace="http://localhost:8081/List/services/List" ...
>
> However, my schema namespace isn't so simple. In fact, I have two
> schemas for some reason. They are:
>
> <wsdl:types>
> <schema
> targetNamespace="http://localhost:8081/List/services/List"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://localhost/List" />
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
>
> </schema>
> <schema targetNamespace="http://localhost/List"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
>
> <complexType name="ListKey">
> <all>
> <element name="value" type="xsd:string" />
> </all>
> </complexType>
> <complexType name="ListOfThings">
> <all>
> <element name="key" type="impl:ListKey" />
> </all>
> </complexType>
> </schema>
> </wsdl:types>
>
> In the interest of full disclosure, I had to create custom Serializers
> because Laszlo also can't handle an xsd:sequence, so I'm using an
> xsd:all for my complexTypes. Here's the writeSchema method for one of
> my types:
>
> public Element writeSchema(Class javaType, Types types) throws
> Exception {
> Element complexTypeElement = types.createElement("complexType");
> complexTypeElement.setAttribute("name", "ListKey");
> Element allElement = types.createElement("all");
> complexTypeElement.appendChild(allElement);
> Element elementElement = types.createElement("element");
> elementElement.setAttribute("name", "value");
> elementElement.setAttribute("type", "xsd:string");
> allElement.appendChild(elementElement);
>
> types.writeSchemaElement(ListManagerAxisDelegate.NAMESPACE,
> complexTypeElement);
>
> return complexTypeElement;
> }
>
> And elsewhere, I have ListManagerAxisDelegate.NAMESPACE set to be:
>
> http://localhost:8081/List/services/List
>
> So, I need to figure out who to get the targetNamespace of the schema
> with my types to match the targetNamespace of my wsdl:definitions.
> The thing is, I thought I took care of that by using the
> writeSchemaElemnt... but that just ended up creatign an additional schema!
>
>
> Any ideas?
>
> Regards,
> Brian.
>
>
>