users@jax-rpc.java.net

[REPOST] doubt on wscompile & header in the output message

From: Alessio Cervellin <alessio.cervellin_at_sun-cs-italy.com>
Date: Mon, 13 Dec 2004 20:13:56 +0100

I'm sorry for this repost
(https://jax-rpc.dev.java.net/servlets/BrowseList?list=users&by=thread&from=132439),
but I'm still searching for an answer to understand this issue.... can
someone help me?

Here is the problem:
By feeding the attached wsdl (see below) to:
wscompile -gen:server -keep -f:explicitcontext
it generates the following interface:

public interface TestcasePortType extends java.rmi.Remote {
public java.lang.String newOperation(java.lang.String arg1,
testcase.holders.ComplexElement2Holder arg2) throws
java.rmi.RemoteException;
}

what I notice is:
1- it returns only a String (attr1), which i defined as soap:body
output, and it does NOT return also ComplexElement2 (attr2) which i
defined as soap:header output.
2- the type of the second parameter of newOperation,
ComplexElement2Holder, has no much sense (to me) because it contains
only the object ComplexElement2, so why to encapsulate it in an "holder"
object? shouldn't it just be "ComplexElement2 arg2"?

The most important implication of the first point is I can't manipulate,
from the server-side code, the whole output message (body+header) to
send back to the client (except by using some handler).

What I was expecting from wscompile was the generation of an interface
like this:

public interface TestcasePortType extends java.rmi.Remote {
public ComplexElement12Holder newOperation(java.lang.String arg1,
testcase.ComplexElement2 arg2) throws java.rmi.RemoteException;
}

i mean a method which accepts two parameters (corresponding to
soap:body and soap:header defined in the INPUT mesage) and returns an
"holder" (here i called it "ComplexElement12Holder") which should
encapsulate two objects of type ComplexElement1 and ComplexElement2
(corresponding to soap:body and soap:header defined in the OUTPUT message).

Here is a sample WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
     name="testcase"
     targetNamespace="http://www.your-company.com/testcase.wsdl"
     xmlns:import1="http://test/"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
     xmlns:tns="http://www.your-company.com/testcase.wsdl"
     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <wsdl:types>
         <xsd:schema
             attributeFormDefault="unqualified"
             elementFormDefault="qualified"
             targetNamespace="http://test/"
             xmlns="http://test/"
             xmlns:myns="http://test/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema">
             <xsd:import
                 namespace="http://schemas.xmlsoap.org/soap/envelope/"
schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"/>
             <xsd:element name="ComplexElement1">
                 <xsd:complexType>
                     <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
                 </xsd:complexType>
             </xsd:element>
             <xsd:element name="ComplexElement2">
                 <xsd:complexType>
                     <xsd:attribute name="attr2" type="xsd:string"
use="required"/>
                 </xsd:complexType>
             </xsd:element>
         </xsd:schema>
     </wsdl:types>
     <wsdl:message name="NewMessageRequest">
         <wsdl:part element="import1:ComplexElement1" name="arg1"/>
         <wsdl:part element="import1:ComplexElement2" name="arg2"/>
     </wsdl:message>
     <wsdl:portType name="testcasePortType">
         <wsdl:operation name="NewOperation">
             <wsdl:input message="tns:NewMessageRequest"/>
             <wsdl:output message="tns:NewMessageRequest"/>
         </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="testcaseBinding" type="tns:testcasePortType">
         <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
         <wsdl:operation name="NewOperation">
             <soap:operation style="document"/>
             <wsdl:input>
                 <soap:body parts="arg1" use="literal"/>
                 <soap:header message="tns:NewMessageRequest"
part="arg2" use="literal">
</soap:header>
             </wsdl:input>
             <wsdl:output>
                 <soap:body parts="arg1" use="literal"/>
                 <soap:header message="tns:NewMessageRequest"
part="arg2" use="literal">
</soap:header>
             </wsdl:output>
         </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="testcase">
         <wsdl:port binding="tns:testcaseBinding" name="testcasePort">
             <soap:address location="http://myhost/testcase"/>
         </wsdl:port>
     </wsdl:service>
</wsdl:definitions>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net