aspose file tools*
The moose likes Web Services and the fly likes xsd compilation problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "xsd compilation problem" Watch "xsd compilation problem" New topic
Author

xsd compilation problem

Jaspreet Singh Puri
Greenhorn

Joined: Jul 15, 2007
Posts: 3
Hi all,

I am trying to compile a schema that includes a namespace xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" using jaxb 2.1.6

The schema is as follows.

<xsd:schema
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.xxxx.co.uk/tss/chart/schema"
xmlns:chart="http://www.tmobile.co.uk/tss/chart/schema"
xmlns1="http://www.tmobile.co.uk/tss/chart/schema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/">

<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />

<xsd:complexType name="ArrayOf_xsd_string">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>


When ever i try to compile i get the following error

[ERROR] src-resolve: Cannot resolve the name 'soapenc:Array' to a(n) 'type definition' component.

I have checked the schema at location http://schemas.xmlsoap.org/soap/encoding/ and it has the the definations. Dont know why its behaving like this.

Any help will be very much appreciated.

Regards
Jaspreet
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
I'd question the motivations for using that schema.

Section 5 SOAP Encoding is governed by additional rules that cannot be captured in an XML Schema.

SOAP encoding is basically a lost cause which has been abandoned by current SOAP stacks.

Avoid it at all cost.



Also you imported the namespace but you didn't specify a location for the schema (the namespace identifier is a URI and in this case it looks like a URL but it doesn't have be an addressable URL - which is why you have to specify a schema location).



Usually it is more efficient and reliable to access a local rather than a remote copy of the schema.
Jaspreet Singh Puri
Greenhorn

Joined: Jul 15, 2007
Posts: 3
Hi Peer,

You are absolutely right. We should avoid using schema definition from http://schemas.xmlsoap.org/soap/encoding/. In my case, I have to migrate a
axis 1.2 wsdl that uses these schema definitions so am forced to use it.

Accessing it locally solves the problem.

Thank you very much.

Kind Regards

Jaspreet
SCJP
SCWCD
SCBCD
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Jaspreet Singh Puri:
You are absolutely right. We should avoid using schema definition from http://schemas.xmlsoap.org/soap/encoding/. In my case, I have to migrate a axis 1.2 wsdl that uses these schema definitions so am forced to use it.


The WSDL fragment indicates that you do not realize that you shouldn't be basing any new XML types on that schema even if you have to use it. SOAP encoding is not XML Schema driven. It is simply a loose set of rules of how data structures are transformed to semi-structured XML data and back. These rules are out-lined in Section 5 SOAP Encoding. The soap encoding schema was created as an afterthought. Its heavy use of the xs:any type (which accepts any well formed XML without any further definition of structure) highlights XML Schema's inability to capture the rules of how SOAP encoding structures its XML data. Even though WSDL is XML Schema based it side steps the issue because the "encoded" message mode moves the definition of the payload format outside of the scope of the WSDL.

RPC/Encoded may generate well formed XML, but it isn't a useful XML document in the XML Schema sense - so the use of XML Schema driven tools will be at best not very useful (you are still going to have to deal with those <xs:any> manually during marshalling and unmarshalling), at worse a serious risk to your project.

So if you have to use SOAP Encoding you will need an engine that does the marshalling/unmarshalling for you (that is what implementations of javax.xml.rpc.encoding.Serializer andjavax.xml.rpc.encoding.Deserializer are for)
- WSDL, XML Schema and XML Schema driven tools are not going to help you.

And what do you mean by migrating? SOAP encoding already knows how to deal with arrays of string so there is no need for the ArrayOf_xsd_string type.

If you are migrating to document/literal you have to get rid of soap encoding anyway.
[ March 12, 2008: Message edited by: Peer Reynders ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xsd compilation problem