Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

WSDL for web method with parameters from different namespaces

843833Aug 29 2007 — edited Aug 29 2007
I'm trying to create a web service that exposes a method that accepts a JAXB XML object and a timestamp as parameters and returns another JAXB XML object. I've tried to follow the contract-first method by creating the schema and WSDLs first. I've created the schemas for the XML and deployed them on a web server and I've written the following WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:tns="http://bar.org"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyWebService"
	xmlns:ns0="http://foo.org/Transaction"
	xmlns:ns1="http://bar.org/TransactionResponse"
	targetNamespace="http://bar.org">
	
	<!-- T Y P E S -->
	<wsdl:types>
		<xsd:schema targetNamespace="http://bar.org"
		    xmlns:ns0="http://foo.org/Transaction"
		    xmlns:ns1="http://bar.org/TransactionResponse"
		    xmlns="http://bar.org">
			<xsd:import namespace="http://foo.org/Transaction" schemaLocation="http://myHost/schemas/Transaction.xsd"/>
			<xsd:import namespace="http://bar.org/TransactionResponse" schemaLocation="http://myHost/schemas/TransactionResponse.xsd"/>
			
			<xsd:element name="ProcessTransactionRequest">
			    <xsd:complexType>
			        <xsd:sequence>
			            <xsd:element ref="ns0:Transaction"/>
			            <xsd:element name="TransactionTime" type="xsd:dateTime"/>
			        </xsd:sequence>
			    </xsd:complexType>
			</xsd:element>
		</xsd:schema>
	</wsdl:types>
	
	<!-- M E S S A G E S -->
	<wsdl:message name="ProcessTransactionRequest">
		<wsdl:part element="tns:ProcessTransactionRequest" name="parameters" />
	</wsdl:message>
	<wsdl:message name="ProcessTransactionResponse">
		<wsdl:part element="ns1:TransactionResponse" name="parameters" />
	</wsdl:message>
	
	<!-- P O R T   T Y P E -->
	<wsdl:portType name="MyWebServicePortType">
		<wsdl:operation name="ProcessTransaction">
			<wsdl:input message="tns:ProcessTransactionRequest" />
			<wsdl:output message="tns:ProcessTransactionResponse" />
		</wsdl:operation>
	</wsdl:portType>
	
	<!-- B I N D I N G -->
	<wsdl:binding name="MyWebServiceSOAP" type="tns:MyWebServicePortType">
		<soap:binding style="document"
			transport="http://schemas.xmlsoap.org/soap/http" />
		<wsdl:operation name="ProcessTransaction">
			<soap:operation soapAction=""/>
			<wsdl:input>
				<soap:body use="literal"/>
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal"/>
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	
	<!-- S E R V I C E -->
	<wsdl:service name="MyWebService">
		<wsdl:port binding="tns:MyWebServiceSOAP" name="MyWebServiceSOAP">
			<soap:address location="http://www.example.org/"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>
However when I run the WsImport tool bundled with JAX-WS RI 2.1.1, I get the following interface:
public interface MyWebServicePortType {


    /**
     * 
     * @param parameters
     * @return
     *     returns org.bar.transactionresponse.TransactionResponse
     */
    @WebMethod(operationName = "ProcessTransaction")
    @WebResult(name = "TransactionResponse", targetNamespace = "http://bar.org/TransactionResponse", partName = "parameters")
    public TransactionResponse processTransaction(
        @WebParam(name = "ProcessTransactionRequest", targetNamespace = "http://bar.org", partName = "parameters")
        ProcessTransactionRequest parameters);

}
Which is workable, but I was wondering how to modify the WSDL to get a web method signature similar to:
public TransactionResponse processTransaction(
        @WebParam(name = "Transaction", targetNamespace = "http://foo.org/Transaction", partName = "transaction")
        Transaction transaction,
        @WebParam(name = "TransactionTime", targetNamespace = "http://bar.org", partName = "transactionTime")
        XMLGregorianCalendar transactionTime);
With two parameters in the parameter list instead of one. Is there a way to do this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 26 2007
Added on Aug 29 2007
1 comment
461 views