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 Peter Durrant <pe...@comopt.com> on 2002/05/08 12:36:48 UTC

XML parameters using SOAP between JDOM and XMLDocument (.NET)

Hi

I am developing a SOAP service using Tomcat/Axis. I want to implement a
Java function that takes XML as a parameter and return XML. The clients
will be written in .NET (C#).

For my initial prototype I encoded my function using strings containing
the XML:

	public String xmlapi(String message) {
		// Process message and return a XML formatted reply
	}

This works fine, but is it a sensible solution? (It's a trivial solution
to get this to work using Axis with a .NET client!)


Would it be better to pass parameters as XML elements? For example,
using JDOM (latest beta release v8), could I do the following?

	public org.jdom.Element xmlapi(org.jdom.Element message) {
		// Process message and return a XML formatted reply
	}

I have tried this method, but being a SOAP newbie I don't know whether
the WSDL can properly define a type of org.jdom.Element. I did construct
a WSDL for this service in AXIS using the <service URL>?WSDL method and
then tried to use the MS WSDL tool to create a C# class. However, when I
use org.jdom.Element as the parameter type I get the following error
from MS WSDL:

Error: Unable to import binding 'MyServiceSoapBinding' from namespace
'<omitted>'.
  - Unable to import operation 'xmlapi'.
  - The datatype 'Array' is missing.


The WSDL file produced by AXIS starts with:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://localhost:8090/axis/services/MyService"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:impl="http://localhost:8090/axis/services/MyService-impl"
xmlns:intf="http://localhost:8090/axis/services/MyService"
xmlns:tns1="http://jdom.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><types><schema
targetNamespace="http://jdom.org"
xmlns="http://www.w3.org/2001/XMLSchema"><complexType
name="Element"><sequence><element name="name" nillable="true"
type="xsd:string"/><element name="namespace" nillable="true"
type="tns1:Namespace"/><element name="Attributes" nillable="true"
type="SOAP-ENC:Array"/><element name="Content" nillable="true"
type="SOAP-ENC:Array"/><element name="Children" nillable="true"
type="SOAP-ENC:Array"/><element name="Text" nillable="true"
type="xsd:string"/></sequence></complexType><complexType
name="Namespace"><sequence><element name="NO_NAMESPACE" nillable="true"
type="tns1:Namespace"/><element name="XML_NAMESPACE" nillable="true"
type="tns1:Namespace"/></sequence></complexType><element name="Element"
nillable="true" type="tns1:Element"/></schema></types>
...
...


Perhaps even this approach is overkill because I'm really just wanting
to pass XML around and this is (obviously) what SOAP uses as a language.
Is there a better solution?


I'd be gratefull for any guidance or help received! :-)

Thanks in advance for any help.

Pete
--
Dr Peter Durrant
ComOpt UK
Cardiff