Axis Webservices

N

Nick

Hi All,
I'm creating a number of Webservices which are all being handled by a
single Java omponent - WebserviceBroker

I've used axis to expose the WebserviceBroker.ProcessMessage method
that takes a single string parameter containing an XML fragment.

This works fine and my services work fine. The problem I have is with
making them available for a service consumer. I need to Provide a WSDL
which accurately defines what messages are acceptable as input.

I can see the axis generated WSDL for my services but it specifies
input and output of type="xsd:anyType" which isn't much use to my
consumers.

I have hand coded a WSDL which contains a much more precise definition
of the xml messages/structures and elements. I have even been able to
make Axis display my WSDL in the Services/<name>?wsld by adding in a
reference to my document in the server-config.wsdd.

What I can't do is get Axis to validate the input against the
schema!!!!! If I give my handcoded WSDL to my customers I am relying on
them to send valid messages in but its not enforced and that opens me
up to any input message.

I can write a schema validation class and chain it to the global
request response flow but I'd rather not. I think this is a common
requirement and I don't like to write code where I think a standard
configurable component might work better.

Anyone got any advice?
 
C

Chris Smith

Nick said:
I can write a schema validation class and chain it to the global
request response flow but I'd rather not. I think this is a common
requirement and I don't like to write code where I think a standard
configurable component might work better.

Since you have asked Axis to allow any XML in the world as a parameter
to your one operation, I believe Axis won't validate it. I don't
understand why you've done that, but unless you are willing to revisit
that design decision, you will just have to validate against the
appropriate schema on your own. It's not hard to do, really.

If you are willing to revisit that design decision, then you may
consider specifying the various operations separately, and making use of
other mechanisms for capturing common aspects of all your web service
calls... for example, you could use good old OO design techniques, or
additional handlers in Axis's chains.
 
N

Nick

Chris said:
Since you have asked Axis to allow any XML in the world as a parameter
to your one operation, I believe Axis won't validate it. I don't
understand why you've done that, but unless you are willing to revisit
that design decision, you will just have to validate against the
appropriate schema on your own. It's not hard to do, really.

If you are willing to revisit that design decision, then you may
consider specifying the various operations separately, and making use of
other mechanisms for capturing common aspects of all your web service
calls... for example, you could use good old OO design techniques, or
additional handlers in Axis's chains.

Thanks for that Chris, I think I will have to validate the approriate
schema as you said.

The reason behind the single input parameter is that I am leveraging
existing middleware translation code behind my broker component. The
existing code works on plain old XML and is configurable via xml/xslt.
I can configure new services without any code compilation. Its not very
OO but it makes my development really straight forward. If possible I
wanted to retain the ability to add new services without having to
write any java code.

A handler in an Axis chain which reads and validates against service
specific schema may be my best option.

thanks again,
Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top