axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xia, Ge" <g...@iKnowMed.com>
Subject RE: If two methods have different names but same parameters, the first one is always called.
Date Fri, 07 Feb 2003 00:46:53 GMT
Thank you very much for your reply.  

I did an experiment - I changed my service to rpc style and both clients worked! Unfortunately
my service needs to be deployed as doc/lit style since we don't want encodings and multi-refs
in the xml messages. So my questions are:

1. In this scenario, is it true that for doc/lit services I need to use different element
names and different messages(parts) in wsdl for each operation, since clients cannot share
the same message/part definition? It also means I need to have different complexType definitions
in the schema? The result will be the new client will have two sets of objects where one of
them is not needed. 

2. Any possibilities that Axis will support this in doc/lit services in the future?

Thanks,

-Ge    


-----Original Message-----
From: Tom Jordahl [mailto:tomj@macromedia.com]
Sent: Thursday, February 06, 2003 11:19 AM
To: 'axis-user@ws.apache.org'
Subject: RE: If two methods have different names but same parameters,
the first one is always called.



If the elements you are sending to a document style service have exactly the same QName, then
Axis will dispatch on this QName and only one operation will be invoked.

The operation name is not used in document/literal services.  This is what the rpc style is
for - to wrap the arguments to an operation in the operation name.

If you have different element names, then you should be able to configure the server .wsdd
file with the element QName that should go to each operation.  i.e. myNS:newarg goes to op1
and myNS:oldarg goes to op2.

--
Tom Jordahl
Macromedia Server Development

-----Original Message-----
From: Xia, Ge [mailto:gxia@iKnowMed.com] 
Sent: Wednesday, February 05, 2003 12:54 PM
To: axis-user@xml.apache.org
Subject: RE: If two methods have different names but same parameters, the first one is always
called.

Sorry I didn't make it clear. I have one definition for each element in the schema, but in
each element complex type, the last element ("extraElement") is not in the old client's schema.
In wsdl I am using the same part name for both operations.

Here is the schema:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://axis.singleSignOn.knowmed.com/schema" xmlns="http://axis.singleSignOn.knowmed.com/schema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" elementFormDefault="qualified">
	<!-- Element names will be the tag names in xml message -->
	<xsd:element name="PrepareSession" type="PrepareSessionRequest"/>
	<xsd:element name="PrepareSessionResponse" type="PrepareSessionResponse"/>	
	<xsd:complexType name="PrepareSessionRequest">
		<xsd:all>
			<xsd:element name="user" type="xsd:string"/>
			<xsd:element name="organizationId" type="xsd:string" nillable="true" minOccurs="0"/>
			<xsd:element name="patient" nillable="true" minOccurs="0">
				<xsd:complexType>
					<xsd:all>
						<xsd:element name="idType" type="xsd:string" nillable="true" minOccurs="0"/>
						<xsd:element name="idValue" type="xsd:string" nillable="true" minOccurs="0"/>
					</xsd:all>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="visitDate" type="xsd:date" nillable="true" minOccurs="0"/>
			<!-- This element is only for new client -->
			<xsd:element name="extraElement" type="xsd:string" nillable="true" minOccurs="0"/>
		</xsd:all>
	</xsd:complexType>
	<xsd:complexType name="PrepareSessionResponse">
		<xsd:all>
			<xsd:element name="sessionId" type="xsd:string"/>
			<xsd:element name="browserCommandUrl" type="xsd:string"/>
			<!-- This element is only for new client -->
			<xsd:element name="extraElement" type="xsd:string" nillable="true" minOccurs="0"/>
		</xsd:all>
	</xsd:complexType>
</xsd:schema>

And here is wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://axis.singleSignOn.knowmed.com"
xmlns:intf="http://axis.singleSignOn.knowmed.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://axis.singleSignOn.knowmed.com/schema">
	<import namespace="http://axis.singleSignOn.knowmed.com/schema" location="file:///c:/iknowmed/axis/schema/singleSignOn2.xsd"/>
	<wsdl:message name="prepareSessionRequest">
		<wsdl:part name="prepareSessionReq" element="xsd1:PrepareSession"/>
	</wsdl:message>
	<wsdl:message name="prepareSessionResponse">
		<wsdl:part name="prepareSessionResp" element="xsd1:PrepareSessionResponse"/>
	</wsdl:message>

	<wsdl:portType name="SingleSignOnServer">		
		<wsdl:operation name="prepareSession">
			<wsdl:input name="prepareSessionRequest" message="intf:prepareSessionRequest"/>
			<wsdl:output name="prepareSessionResponse" message="intf:prepareSessionResponse"/>
		</wsdl:operation>
		
		<wsdl:operation name="prepareSession2">
			<wsdl:input name="prepareSessionRequest" message="intf:prepareSessionRequest"/>
			<wsdl:output name="prepareSessionResponse" message="intf:prepareSessionResponse"/>
		</wsdl:operation>
	</wsdl:portType>
	
	<wsdl:binding name="SingleSignOnSoapBinding" type="intf:SingleSignOnServer">
		<wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
		
		<wsdl:operation name="prepareSession">
			<wsdlsoap:operation soapAction="http://axis.singleSignOn.knowmed.com" style="document"/>
			<wsdl:input name="prepareSessionRequest">
				<wsdlsoap:body namespace="http://axis.singleSignOn.knowmed.com" use="literal"/>
			</wsdl:input>
			<wsdl:output name="prepareSessionResponse">
				<wsdlsoap:body namespace="http://axis.singleSignOn.knowmed.com" use="literal"/>
			</wsdl:output>
		</wsdl:operation>
		
		<wsdl:operation name="prepareSession2">
			<wsdlsoap:operation soapAction="http://axis.singleSignOn.knowmed.com" style="document"/>
			<wsdl:input name="prepareSessionRequest">
				<wsdlsoap:body namespace="http://axis.singleSignOn.knowmed.com" use="literal"/>
			</wsdl:input>
			<wsdl:output name="prepareSessionResponse">
				<wsdlsoap:body namespace="http://axis.singleSignOn.knowmed.com" use="literal"/>
			</wsdl:output>
		</wsdl:operation>

	</wsdl:binding>
	<wsdl:service name="SingleSignOnService">
		<wsdl:port binding="intf:SingleSignOnSoapBinding" name="SingleSignOn">
			<wsdlsoap:address location="http://10.7.206.32:8081/axis/services/SingleSignOn"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>



-----Original Message-----
From: Glen Daniels [mailto:gdaniels@macromedia.com]
Sent: Tuesday, February 04, 2003 8:57 PM
To: 'axis-user@xml.apache.org'
Subject: RE: If two methods have different names but same parameters,
the first one is always called.



What do your types/parts look like?  You can't have multiple definitions for the same element
in schema, so I'm not quite sure how you'd express what you're talking about (i.e. one method
which takes the "old" version and another which takes the "new").

--Glen

> -----Original Message-----
> From: Xia, Ge [mailto:gxia@iKnowMed.com]
> Sent: Tuesday, February 04, 2003 6:02 PM
> To: axis-user@xml.apache.org
> Subject: If two methods have different names but same parameters, the
> first one is always called.
> 
> 
> I am using axis beta 1.1. My old document style service has a 
> method: outObject method1(inObject in);
> I use WSDL2Java tool to generate the server side classes. 
> Everything is working fine. 
> 
> Now I need to add an extra element to both inObject and 
> outObject(in the type definition in wsdl) and create a new 
> service method: outObject method2(inObject in); for a new 
> client to use, but I don't want to break the client who has 
> the old type definitions and who is still calling method1.
> 
> The two operations are defined in wsdl in this order:
> 
> <wsdl:operation name="method1">
> 	.....
> </wsdl:operation> 
> 
> <wsdl:operation name="method2">
> 	.....
> </wsdl:operation>  
> 
> The problem is when my new client calls method2(inObject) the 
> server always invokes method1(inObject). If I put operation 
> method2 before method1 in wsdl and re-generate the server 
> classes, the new client works. But the old client breaks 
> because it is calling method2 which contains an 
> unrecognizable extra element. 
> 
> It seems that axis doesn't use method name to find an 
> operation. It always finds the first operation whose 
> parameters match the one passed in, in this case the first 
> operation defined in the wsdl file. Is this a bug? If not, 
> does anyone know what could be a workaround?
> 
> Thanks in advance.
>  
> 
> 
> 

Mime
View raw message