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 Frank Cohen <fc...@pushtotest.com> on 2004/12/24 16:25:16 UTC

Document literal with complex data types

It suprises me how little knowledge is out there for a Java developer 
to learn how to write Web Service consumers (clients) that can handle 
document-literal encoding of complex data types. I found a very good 
article on this topic at: 
http://www.sys-con.com/webservices/article.cfm?id=674

I manage an open source utility and framework for testing Web Services 
for scalability and performance. (Details on TestMaker are at 
http://www.pushtotest.com) I'm working on a more advanced Wizard to 
create test agent scripts for SOAP-based Web Services. The new Wizard 
will write a Jython script that makes a doc-lit/complex-type call to a 
service.

One of the things I've noticed about WSDL from a .NET Web Service is 
the use of schema include statements. In a <types><schemas> element 
I'll find something like this:

<s:import 
namespace="http://schemas.webservices.payroll-service.biz/payroll/" 
schemaLocation="payroll.xsd"/>

WSDL4J, JDOM and other WSDL handling libraries do not appear to handle 
an import. I found an open-source library that tries to do an XML 
include: http://xincluder.sourceforge.net/

I'm wondering if anyone knows how to best handle an import?

-Frank Cohen
fcohen@pushtotest.com


---
Frank Cohen, PushToTest, http://www.PushToTest.com, phone: 408 374 7426
Author of "Java Testing and Design: From Unit Tests to Automated Web 
Tests"
from Prentice Hall, details at http://thebook.pushtotest.com


Re: Document literal with complex data types

Posted by Frank Cohen <fc...@pushtotest.com>.
Thanks for your reply Dennis. I appreciate the pointers and 
watch-out-for-these things.

Ok, it's off to Castor I go. I'll let you and the Axis list know how it 
goes.

Is there anything in the Axis project that shows how to interoperate 
with .NET services? In my experience it's .NET tools that use schema 
imports and complex data types.

-Frank


On Dec 24, 2004, at 10:21 AM, Dennis Sosnoski wrote:

> You've actually got three different types of special operations to 
> deal with. First off, WSDL has it's own <wsdl:import>, which is 
> available for constructing modular WSDLs. I haven't seen it used much, 
> though. Second and third, XML Schema defines <xsd:import> (for making 
> use of components from another namespace) and <xsd:include> (for 
> making use of added components within the same namespace) elements 
> used in constructing modular schemas. These are widely used, with 
> <xsd:import> especially common with Web services. There's also yet 
> another way of bringing components into a schema definition, with 
> <xsd:redefine> (ugly even by comparison with the rest of schema), but 
> I've never seen that used in a Web services context.
>
> All of these are different from XInclude. They need to be processed at 
> the WSDL and schema layers, so unless you base your handling on code 
> that supports at least the basic schema operations you're probably out 
> of luck. In my experience Axis's WSDL2Java code appears to handle 
> <xsd:import> correctly, at least when the imported schema definition 
> is included in the same WSDL. I don't think I've tried it with schema 
> definitions that are external to the WSDL.
>
> Castor's code generation from schema definitely works with 
> <xsd:import> and <xsd:include>, though to use it you'd need to split 
> the component schemas out of the WSDL (which will often have multiple 
> schema definitions) and probably save them as local files, adding 
> schemaLocation attributes to the <xsd:import> statements. The whole 
> process is probably going to be a little involved, but that should 
> point you in the right direction if you want to go with Castor.
>
>  - Dennis
>
> -- 
> Dennis M. Sosnoski
> Enterprise Java, XML, and Web Services
> Training and Consulting
> http://www.sosnoski.com
> Redmond, WA  425.885.7197
>
>
> Frank Cohen wrote:
>
>> It suprises me how little knowledge is out there for a Java developer 
>> to learn how to write Web Service consumers (clients) that can handle 
>> document-literal encoding of complex data types. I found a very good 
>> article on this topic at: 
>> http://www.sys-con.com/webservices/article.cfm?id=674
>>
>> I manage an open source utility and framework for testing Web 
>> Services for scalability and performance. (Details on TestMaker are 
>> at http://www.pushtotest.com) I'm working on a more advanced Wizard 
>> to create test agent scripts for SOAP-based Web Services. The new 
>> Wizard will write a Jython script that makes a doc-lit/complex-type 
>> call to a service.
>>
>> One of the things I've noticed about WSDL from a .NET Web Service is 
>> the use of schema include statements. In a <types><schemas> element 
>> I'll find something like this:
>>
>> <s:import 
>> namespace="http://schemas.webservices.payroll-service.biz/payroll/" 
>> schemaLocation="payroll.xsd"/>
>>
>> WSDL4J, JDOM and other WSDL handling libraries do not appear to 
>> handle an import. I found an open-source library that tries to do an 
>> XML include: http://xincluder.sourceforge.net/
>>
>> I'm wondering if anyone knows how to best handle an import?
>>
>> -Frank Cohen
>> fcohen@pushtotest.com
>
>
---
Frank Cohen, PushToTest, http://www.PushToTest.com, phone: 408 374 7426
Author of "Java Testing and Design: From Unit Tests to Automated Web 
Tests"
from Prentice Hall, details at http://thebook.pushtotest.com


Re: Document literal with complex data types

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
You've actually got three different types of special operations to deal 
with. First off, WSDL has it's own <wsdl:import>, which is available for 
constructing modular WSDLs. I haven't seen it used much, though. Second 
and third, XML Schema defines <xsd:import> (for making use of components 
from another namespace) and <xsd:include> (for making use of added 
components within the same namespace) elements used in constructing 
modular schemas. These are widely used, with <xsd:import> especially 
common with Web services. There's also yet another way of bringing 
components into a schema definition, with <xsd:redefine> (ugly even by 
comparison with the rest of schema), but I've never seen that used in a 
Web services context.

All of these are different from XInclude. They need to be processed at 
the WSDL and schema layers, so unless you base your handling on code 
that supports at least the basic schema operations you're probably out 
of luck. In my experience Axis's WSDL2Java code appears to handle 
<xsd:import> correctly, at least when the imported schema definition is 
included in the same WSDL. I don't think I've tried it with schema 
definitions that are external to the WSDL.

Castor's code generation from schema definitely works with <xsd:import> 
and <xsd:include>, though to use it you'd need to split the component 
schemas out of the WSDL (which will often have multiple schema 
definitions) and probably save them as local files, adding 
schemaLocation attributes to the <xsd:import> statements. The whole 
process is probably going to be a little involved, but that should point 
you in the right direction if you want to go with Castor.

  - Dennis

-- 
Dennis M. Sosnoski
Enterprise Java, XML, and Web Services
Training and Consulting
http://www.sosnoski.com
Redmond, WA  425.885.7197


Frank Cohen wrote:

> It suprises me how little knowledge is out there for a Java developer 
> to learn how to write Web Service consumers (clients) that can handle 
> document-literal encoding of complex data types. I found a very good 
> article on this topic at: 
> http://www.sys-con.com/webservices/article.cfm?id=674
>
> I manage an open source utility and framework for testing Web Services 
> for scalability and performance. (Details on TestMaker are at 
> http://www.pushtotest.com) I'm working on a more advanced Wizard to 
> create test agent scripts for SOAP-based Web Services. The new Wizard 
> will write a Jython script that makes a doc-lit/complex-type call to a 
> service.
>
> One of the things I've noticed about WSDL from a .NET Web Service is 
> the use of schema include statements. In a <types><schemas> element 
> I'll find something like this:
>
> <s:import 
> namespace="http://schemas.webservices.payroll-service.biz/payroll/" 
> schemaLocation="payroll.xsd"/>
>
> WSDL4J, JDOM and other WSDL handling libraries do not appear to handle 
> an import. I found an open-source library that tries to do an XML 
> include: http://xincluder.sourceforge.net/
>
> I'm wondering if anyone knows how to best handle an import?
>
> -Frank Cohen
> fcohen@pushtotest.com 


Re: Document literal with complex data types

Posted by Frank Cohen <fc...@pushtotest.com>.
Thanks for the pointers Jeff. I'll take a look at WSIF again. I'll let 
the list know what i find and how I'll use it.

Is there anything in the Axis project that shows how to interoperate 
with .NET services? In my experience it's .NET tools that use schema 
imports and complex data types.

-Frank


On Dec 24, 2004, at 9:13 AM, Jeff Greif wrote:

> Frank,
>
> Thanks for the article.  Using saaj to construct WS requests seems 
> better
> than jumping through the various hoops that are necessary for dynamic
> invocation in axis for doc/lit services, in cases where it's easy for 
> the
> client to directly construct the document that is transmitted in the 
> soap
> body, no soap handlers are needed in the processing, etc.
>
> For handling schema/wsdl imports, I use the org.apache.wsif.schema 
> package
> (see the WSIF project at apache).  In my case, it's more complicated 
> because
> there may be local copies of the schema and wsdl documents, and the
> extraction of these has to be integrated with a catalog.  Thus, my code
> traverses the graph of wsdl and schema imports directly.  Note that
> javax.wsdl.xml.WSDLReader will follow wsdl imports but not schema 
> imports
> and includes, which org.apache.wsif.schema.Schema and
> org.apache.wsif.schema.Parser will help to process.
>
> Jeff
>
> ----- Original Message -----
> From: "Frank Cohen" <fc...@pushtotest.com>
> To: <ax...@ws.apache.org>
> Sent: Friday, December 24, 2004 7:25 AM
> Subject: Document literal with complex data types
>
>
>> It suprises me how little knowledge is out there for a Java developer
>> to learn how to write Web Service consumers (clients) that can handle
>> document-literal encoding of complex data types. I found a very good
>> article on this topic at:
>> http://www.sys-con.com/webservices/article.cfm?id=674
>>
>> I manage an open source utility and framework for testing Web Services
>> for scalability and performance. (Details on TestMaker are at
>> http://www.pushtotest.com) I'm working on a more advanced Wizard to
>> create test agent scripts for SOAP-based Web Services. The new Wizard
>> will write a Jython script that makes a doc-lit/complex-type call to a
>> service.
>>
>> One of the things I've noticed about WSDL from a .NET Web Service is
>> the use of schema include statements. In a <types><schemas> element
>> I'll find something like this:
>>
>> <s:import
>> namespace="http://schemas.webservices.payroll-service.biz/payroll/"
>> schemaLocation="payroll.xsd"/>
>>
>> WSDL4J, JDOM and other WSDL handling libraries do not appear to handle
>> an import. I found an open-source library that tries to do an XML
>> include: http://xincluder.sourceforge.net/
>>
>> I'm wondering if anyone knows how to best handle an import?
>>
>> -Frank Cohen
>> fcohen@pushtotest.com
>>
>>
>> ---
>> Frank Cohen, PushToTest, http://www.PushToTest.com, phone: 408 374 
>> 7426
>> Author of "Java Testing and Design: From Unit Tests to Automated Web
>> Tests"
>> from Prentice Hall, details at http://thebook.pushtotest.com
>>
>
>
---
Frank Cohen, PushToTest, http://www.PushToTest.com, phone: 408 374 7426
Author of "Java Testing and Design: From Unit Tests to Automated Web 
Tests"
from Prentice Hall, details at http://thebook.pushtotest.com


Re: Document literal with complex data types

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
Frank,

Thanks for the article.  Using saaj to construct WS requests seems better
than jumping through the various hoops that are necessary for dynamic
invocation in axis for doc/lit services, in cases where it's easy for the
client to directly construct the document that is transmitted in the soap
body, no soap handlers are needed in the processing, etc.

For handling schema/wsdl imports, I use the org.apache.wsif.schema package
(see the WSIF project at apache).  In my case, it's more complicated because
there may be local copies of the schema and wsdl documents, and the
extraction of these has to be integrated with a catalog.  Thus, my code
traverses the graph of wsdl and schema imports directly.  Note that
javax.wsdl.xml.WSDLReader will follow wsdl imports but not schema imports
and includes, which org.apache.wsif.schema.Schema and
org.apache.wsif.schema.Parser will help to process.

Jeff

----- Original Message ----- 
From: "Frank Cohen" <fc...@pushtotest.com>
To: <ax...@ws.apache.org>
Sent: Friday, December 24, 2004 7:25 AM
Subject: Document literal with complex data types


> It suprises me how little knowledge is out there for a Java developer
> to learn how to write Web Service consumers (clients) that can handle
> document-literal encoding of complex data types. I found a very good
> article on this topic at:
> http://www.sys-con.com/webservices/article.cfm?id=674
>
> I manage an open source utility and framework for testing Web Services
> for scalability and performance. (Details on TestMaker are at
> http://www.pushtotest.com) I'm working on a more advanced Wizard to
> create test agent scripts for SOAP-based Web Services. The new Wizard
> will write a Jython script that makes a doc-lit/complex-type call to a
> service.
>
> One of the things I've noticed about WSDL from a .NET Web Service is
> the use of schema include statements. In a <types><schemas> element
> I'll find something like this:
>
> <s:import
> namespace="http://schemas.webservices.payroll-service.biz/payroll/"
> schemaLocation="payroll.xsd"/>
>
> WSDL4J, JDOM and other WSDL handling libraries do not appear to handle
> an import. I found an open-source library that tries to do an XML
> include: http://xincluder.sourceforge.net/
>
> I'm wondering if anyone knows how to best handle an import?
>
> -Frank Cohen
> fcohen@pushtotest.com
>
>
> ---
> Frank Cohen, PushToTest, http://www.PushToTest.com, phone: 408 374 7426
> Author of "Java Testing and Design: From Unit Tests to Automated Web
> Tests"
> from Prentice Hall, details at http://thebook.pushtotest.com
>