You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Srinath Perera <he...@vijayaba.cse.mrt.ac.lk> on 2003/07/29 04:48:58 UTC

(Re: How to specify overloaded methods in wsdd) I have a patch

 Hi all

    This is regarding the susantha's qustion. It seems that dims like a
patch. I give it a try, So here it is, Please some commiter have a look
at the patch. this has the patch, test case(If patch is accepted does my
test case is good enough to add as the  test case for the senario).

    Actually this is my first patch (It take more time than write the
code than come pass the     fiewall and create the patch. Thanks for all
who helps me for that regards.)I hope the patch is correct, I follow
instruction in apache site pls let me if anthing worng.

    please let me know if there are much more better ways to do thing
(regarding code,comments anything).

  Any comment regarding this welcome. (I am on my toes to know what
happen to my first Patch)
  Thanks for your time
  regards

  Srinath

 rest of the mail is as follows.
 1) description of logic behind the patch
 2) annoted results about the patch
 3) comment about result 

 Description of logic behind the patch
 -------------------------------------
 User can specify the allowed methods add - that means any overloaded
method of add or add(II),add(III).....
 then they would come to the "List, allowedmethod" in the ServiceDesc 
without breaking anything. (That was a big relef).

 Then I make sure that only the allowed methods can enter the
method2OperationMap. I have private method
 "isAllowedMethod" to help decide whether it is the a
allowedMethod(using the allowedmethod list/ it
 will return true all methods if user specify as e.g. "add" to make sure
that this is backward compatible).

 Then I cover the all the places that you put() on to the hashmap
method2OperationMap with the condition to to make
 sure only methods we need are inside the hash map. (it is at
setTypeMappingRegistry(TypeMappingRegistry tmr) and
 and createOperationForMethod(Method method)).


 The effect of that code seem to be the methods that is not specified is
practially act as they do
 not exists in the original code of service. That what we need I belive
!!!!!!!!!!!!!!
 * to run the test please refer to the comment on the test class

 Annoted result when the Calculator service in server-config.wsdd as
given below.

===============================================================================

 <service name="Calculator" provider="java:RPC">
  <parameter name="allowedMethods"
value="add,multiply(II),multiply([Ljava.lang.String),multiply(Ltest.data.CalcData)"/>
  <parameter name="className" value="test.data.Calculator"/>
  <beanMapping qname="ns:CalcData" xmlns:ns="urn:test.data"
             languageSpecificType="java:test.data.CalcData"/>
 </service>

 add is given in the .wsdd as "add" this test or backword compatibility
*********************** test add(II) ***************************
SUCSESS Got result : 11

************************* test add(III) ************************
SUCSESS Got result : 16
Test specified simple method compatibility

 multiply(II) allowed should be sucessful
****************** test multiply(II) ******************
SUCSESS Got result : 18

 multiply(III) not allowed should fail
************************* test multiply(III) **************************
FAILEURE No such operation 'multiply'
- FAILEURE
AxisFault
 faultCode: Server.userException
 faultSubcode:
 faultString: No such operation 'multiply'
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axis/}stackTrace:AxisFault&#xd;&#xa; faultCode:
Server.userException&#xd;&#xa; faultSubcode: &#xd;&#xa; faultString: No
such operation 'multiply'&#xd;&#xa; faultActor: &#xd;&#xa; faultNode:
&#xd;&#xa; faultDetail: &#xd;&#xa;&#xd;&#xa;No such operation
'multiply'&#xd;&#xa;&#x9;at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:301)&#xd;&#xa;&#x9;at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)&#xd;&#xa;&#x9;at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:184)&#xd;&#xa;&#x9;at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:334)&#xd;&#xa;&#x9;at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)&#xd;&#xa;&#x9;at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)&#xd;&#xa;&#x9;at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)&#xd;&#xa;&#x9;at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:485)&#xd;&#xa;&#x9;at org.apache.axis.server.AxisServer.invoke(AxisServer.java:324)&#xd;&#xa;&#x9;at org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:435)&#xd;&#xa;&#x9;at org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:190)&#xd;&#xa;&#x9;at java.lang.Thread.run(Thread.java:536)&#xd;&#xa;

No such operation 'multiply'
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
	at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1083)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
	at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:252)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:553)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:378)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
	at org.apache.axis.client.Call.invoke(Call.java:2553)
	at org.apache.axis.client.Call.invoke(Call.java:2248)
	at org.apache.axis.client.Call.invoke(Call.java:2171)
	at org.apache.axis.client.Call.invoke(Call.java:1691)
	at
test.deployment.OverloadedMethodRestrictionTest.testSpecifiedSimpleMethod(OverloadedMethodRestrictionTest.java:175)
	at
test.deployment.OverloadedMethodRestrictionTest.main(OverloadedMethodRestrictionTest.java:329)

 Complex type multiply(Ldata.Calculator) allowed should be succsessful
***************** test multiply(Ldata.Calculator)******************
Got result : 3

 multiply([I)allowed should be succsessful
***************** test multiply([I)******************
Got result : 362880

 multiply([I[I)allowed should fail
****************** test multiply[I[I *******************
FAILEURE org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object;
-> int)
- FAILEURE
AxisFault
 faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: org.xml.sax.SAXException: Bad types (class
[Ljava.lang.Object; -&gt; int)
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Bad
types (class [Ljava.lang.Object; -&gt; int)&#xd;&#xa;&#x9;at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:317)&#xd;&#xa;&#x9;at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1031)&#xd;&#xa;&#x9;at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)&#xd;&#xa;&#x9;at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:845)&#xd;&#xa;&#x9;at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)&#xd;&#xa;&#x9;at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)&#xd;&#xa;&#x9;at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:184)&#xd;&#xa;&#x9;at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:334)&#xd;&#xa;&#x9;at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)&#xd;&#xa;&#x9;at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)&#xd;&#xa;&#x9;at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)&#xd;&#xa;&#x9;at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:485)&#xd;&#xa;&#x9;at org.apache.axis.server.AxisServer.invoke(AxisServer.java:324)&#xd;&#xa;&#x9;at org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:435)&#xd;&#xa;&#x9;at org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:190)&#xd;&#xa;&#x9;at java.lang.Thread.run(Thread.java:536)&#xd;&#xa;

org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> int)
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
	at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1083)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
	at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:252)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:553)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:378)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
	at org.apache.axis.client.Call.invoke(Call.java:2553)
	at org.apache.axis.client.Call.invoke(Call.java:2248)
	at org.apache.axis.client.Call.invoke(Call.java:2171)
	at org.apache.axis.client.Call.invoke(Call.java:1691)
	at
test.deployment.OverloadedMethodRestrictionTest.testSpecifiedArrayTypeMethod(OverloadedMethodRestrictionTest.java:262)
	at
test.deployment.OverloadedMethodRestrictionTest.main(OverloadedMethodRestrictionTest.java:331)
Process terminated with exit code 0

 Annoted result when the Calculator service in server-config.wsdd as
given below.

===============================================================================
 <service name="Calculator" provider="java:RPC">
  <parameter name="allowedMethods"
value="add,multiply(II),multiply([Ljava.lang.String),multiply(Ltest.data.CalcData)"/>
  <parameter name="className" value="test.data.Calculator"/>
  <beanMapping qname="ns:CalcData" xmlns:ns="urn:test.data"
             languageSpecificType="java:test.data.CalcData"/>
</service>

this is allowed should be succsessful
*********************** test add(II) ***********************
SUCSESS Got result : 11

this is allowed should be succsessful
************************* test add(III) ************************
SUCSESS Got result : 16
Test specified simple method compatibility

this is not allowed should be fail
****************** test multiply(II) ******************
FAILEURE java.lang.NullPointerException         *** 1)see comment at end
- FAILEURE
AxisFault
 faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.lang.NullPointerException
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axis/}stackTrace:java.lang.NullPointerException&#xd;&#xa;&#x9;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&#xd;&#xa;&#x9;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&#xd;&#xa;&#x9;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&#xd;&#xa;&#x9;at java.lang.reflect.Method.invoke(Method.java:324)&#xd;&#xa;&#x9;at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:402)&#xd;&#xa;&#x9;at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:309)&#xd;&#xa;&#x9;at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:334)&#xd;&#xa;&#x9;at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)&#xd;&#xa;&#x9;at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)&#xd;&#xa;&#x9;at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)&#xd;&#xa;&#x9;at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:485)&#xd;&#xa;&#x9;at org.apache.axis.server.AxisServer.invoke(AxisServer.java:324)&#xd;&#xa;&#x9;at org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:435)&#xd;&#xa;&#x9;at org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:190)&#xd;&#xa;&#x9;at java.lang.Thread.run(Thread.java:536)&#xd;&#xa;
	{http://xml.apache.org/axis/}isRuntimeException:true

java.lang.NullPointerException
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
	at
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1083)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
	at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:252)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:553)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:378)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
	at org.apache.axis.client.Call.invoke(Call.java:2553)
	at org.apache.axis.client.Call.invoke(Call.java:2248)
	at org.apache.axis.client.Call.invoke(Call.java:2171)
	at org.apache.axis.client.Call.invoke(Call.java:1691)
	at
test.deployment.OverloadedMethodRestrictionTest.testSpecifiedSimpleMethod(OverloadedMethodRestrictionTest.java:154)
	at
test.deployment.OverloadedMethodRestrictionTest.main(OverloadedMethodRestrictionTest.java:329)

this is allowed should be succsessful
************************* test multiply(III) **************************
SUCSESS Got result : 90

this is allowed should be succsessful
***************** test multiply(Ldata.Calculator)******************
Got result : 3

this is not allowed should be fail
***************** test multiply([I)******************
Got result : 0               *** 2)see comment at end

this is allowed should be sucsessful
****************** test multiply[I[I *******************
SUCSESS Got result : 735
Process terminated with exit code 0

comments
========
1) the error Nullpointer seem not aceptable but if you call that test on
the unaltered axis with the
multiply(III) in the service removed you get the same result. effect of
my patch is to remove the
method from the class (make it invisible). So it seems at least I do not
break anything.

I have a mail on axis-dev regarding that possible error in exising axis.

2) 1) the error Nullpointer seem not aceptable but if you call that test
on the unaltered axis with the
multiply([Llang.String) in the service removed you get the same result.
It seems the axis engine called
multiply([Llang.String[Llang.String) with the other parameter null.
effect of my patch is to remove the
method from the class (make it invisible). So it seems at least I do not
break anything.

I have a mail on axis-dev regarding that possible error in exising axis.

On Thu, 2003-07-10 at 18:25, Davanum Srinivas wrote:
> Susantha,
> 
> One more tip, you can differentiate between the methods by checking their signature (see details
> at http://java.sun.com/docs/books/tutorial/native1.1/implementing/method.html). For example the
> following 3 methods:
> 
> public int Add(int a, int b);           - Can be represented as "Add(II)I"      
> public long Add(long a, long b);        - Can be represented as "Add(JJ)J"
> public double Add(double a, double b);  - Can be represented as "Add(DD)D"
> 
> If you are willing to patch Axis code to be able to distinguish between methods like this, just
> follow normal patch process
> (http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/SubmitPatches)
> 
> Thanks,
> dims
> 
> --- Davanum Srinivas <di...@yahoo.com> wrote:
> > Susantha,
> > 
> > There is no way to do this right now....See getSyncedOperationsForName method in
> > ServiceDesc.java
> > for details on how we implement the restriction. Maybe you can come up with a patch for the new
> > feature.
> > 
> > Thanks,
> > dims
> > 
> > --- susantha <su...@opensource.lk> wrote:
> > > Hi all,
> > > 
> > > I have a class with a set of overloaded methods and I want to export few of
> > > those methods as a web service
> > > 
> > > Ex:-
> > > 
> > > class MyClass
> > > {
> > > 	public int Add(int a, int b);         <---- method1
> > > 	public Point Add(Point a, Point b);   <---- method2
> > > 	public Square Add(Square a, Square b);<---- method3
> > > }
> > > 
> > > say I want to export only method2 as a web service.
> > > 
> > > So in my wsdd file if I set AllowedMethods = "Add" all 3 methods will be allowed.
> > > How do I make only the method2 exported ?.
> > > 
> > > Thanks,
> > > 
> > > Susantha.
> > > 
> > > ---------------
> > > Lanka Software Foundation  (http://www.opensource.lk.)
> > > Promoting Open-Source Development in Sri Lanka.
> > > ---------------
> > 
> > 
> > =====
> > Davanum Srinivas - http://webservices.apache.org/~dims/
> > 
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> > 
> 
> 
> =====
> Davanum Srinivas - http://webservices.apache.org/~dims/
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 

Instantiation Exception

Posted by "Jeyakumaran.C" <jk...@vijayaba.cse.mrt.ac.lk>.
Hi,
I am working in creating a complex type service.
axis gives an error 
Error : java.lang.InstantiationException: samples.userguide.Point.Point
my Point class is below.
public class Point {

int x;

int y;

public String operations(Order ord) {

int num = ord.getNum();

int x = ord.getX();

int y = ord.getY(); 

Point p = new Point();

if (num == 1) {

p.setX(x * x);

p.setY(y * y);

} else if (num == 2) {

p.setX(x);

p.setY(2 * x + 5);

} else {

p.x = x;

p.y = y;

}

String str = "x = "+p.getX()+" y = " +p.getY();

return str;

}

public int getX() {

return x;

}

public int getY() {

return y;

}

public void setX(int i) {

x = i;

}

public void setY(int i) {

y = i;

}

}

my bean class is Order which is not attached here.

Can anybody help for it.

I followed the example5 in the axis for trying out this service.

Thank u

Jeyakumaran.C



Re: (Re: How to specify overloaded methods in wsdd) I have a patch

Posted by Davanum Srinivas <di...@yahoo.com>.
Srinath,

If it's not too much of a problem....Can you please add this as an enchancement request in
Bugzilla? So that we don't lose the code or the test case.

Thanks,
dims

--- Srinath Perera <he...@vijayaba.cse.mrt.ac.lk> wrote:
>  Hi all
> 
>     This is regarding the susantha's qustion. It seems that dims like a
> patch. I give it a try, So here it is, Please some commiter have a look
> at the patch. this has the patch, test case(If patch is accepted does my
> test case is good enough to add as the  test case for the senario).
> 
>     Actually this is my first patch (It take more time than write the
> code than come pass the     fiewall and create the patch. Thanks for all
> who helps me for that regards.)I hope the patch is correct, I follow
> instruction in apache site pls let me if anthing worng.
> 
>     please let me know if there are much more better ways to do thing
> (regarding code,comments anything).
> 
>   Any comment regarding this welcome. (I am on my toes to know what
> happen to my first Patch)
>   Thanks for your time
>   regards
> 
>   Srinath
> 
>  rest of the mail is as follows.
>  1) description of logic behind the patch
>  2) annoted results about the patch
>  3) comment about result 
> 
>  Description of logic behind the patch
>  -------------------------------------
>  User can specify the allowed methods add - that means any overloaded
> method of add or add(II),add(III).....
>  then they would come to the "List, allowedmethod" in the ServiceDesc 
> without breaking anything. (That was a big relef).
> 
>  Then I make sure that only the allowed methods can enter the
> method2OperationMap. I have private method
>  "isAllowedMethod" to help decide whether it is the a
> allowedMethod(using the allowedmethod list/ it
>  will return true all methods if user specify as e.g. "add" to make sure
> that this is backward compatible).
> 
>  Then I cover the all the places that you put() on to the hashmap
> method2OperationMap with the condition to to make
>  sure only methods we need are inside the hash map. (it is at
> setTypeMappingRegistry(TypeMappingRegistry tmr) and
>  and createOperationForMethod(Method method)).
> 
> 
>  The effect of that code seem to be the methods that is not specified is
> practially act as they do
>  not exists in the original code of service. That what we need I belive
> !!!!!!!!!!!!!!
>  * to run the test please refer to the comment on the test class
> 
>  Annoted result when the Calculator service in server-config.wsdd as
> given below.
> 
> ===============================================================================
> 
>  <service name="Calculator" provider="java:RPC">
>   <parameter name="allowedMethods"
> value="add,multiply(II),multiply([Ljava.lang.String),multiply(Ltest.data.CalcData)"/>
>   <parameter name="className" value="test.data.Calculator"/>
>   <beanMapping qname="ns:CalcData" xmlns:ns="urn:test.data"
>              languageSpecificType="java:test.data.CalcData"/>
>  </service>
> 
>  add is given in the .wsdd as "add" this test or backword compatibility
> *********************** test add(II) ***************************
> SUCSESS Got result : 11
> 
> ************************* test add(III) ************************
> SUCSESS Got result : 16
> Test specified simple method compatibility
> 
>  multiply(II) allowed should be sucessful
> ****************** test multiply(II) ******************
> SUCSESS Got result : 18
> 
>  multiply(III) not allowed should fail
> ************************* test multiply(III) **************************
> FAILEURE No such operation 'multiply'
> - FAILEURE
> AxisFault
>  faultCode: Server.userException
>  faultSubcode:
>  faultString: No such operation 'multiply'
>  faultActor:
>  faultNode:
>  faultDetail:
> 	{http://xml.apache.org/axis/}stackTrace:AxisFault
 faultCode:
> Server.userException
 faultSubcode: 
 faultString: No
> such operation 'multiply'
 faultActor: 
 faultNode:
> 
 faultDetail: 

No such operation
> 'multiply'
	at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:301)
	at
> org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
	at
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:184)
	at
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:334)
	at
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
	at
> org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
	at
> org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
	at
> org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:485)
	at
> org.apache.axis.server.AxisServer.invoke(AxisServer.java:324)
	at
> org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:435)
	at
> org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:190)
	at
> java.lang.Thread.run(Thread.java:536)

> 
> No such operation 'multiply'
> 	at
> org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
> 	at
> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
> 	at
>
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1083)
> 	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
> Source)
> 	at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
> Source)
> 	at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> 	at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
> 	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
> 	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> 	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
> 	at
> org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:252)
> 	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:553)
> 	at org.apache.axis.Message.getSOAPEnvelope(Message.java:378)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
> 	at org.apache.axis.client.Call.invoke(Call.java:2553)
> 	at org.apache.axis.client.Call.invoke(Call.java:2248)
> 	at org.apache.axis.client.Call.invoke(Call.java:2171)
> 	at org.apache.axis.client.Call.invoke(Call.java:1691)
> 	at
>
test.deployment.OverloadedMethodRestrictionTest.testSpecifiedSimpleMethod(OverloadedMethodRestrictionTest.java:175)
> 	at
> test.deployment.OverloadedMethodRestrictionTest.main(OverloadedMethodRestrictionTest.java:329)
> 
>  Complex type multiply(Ldata.Calculator) allowed should be succsessful
> ***************** test multiply(Ldata.Calculator)******************
> Got result : 3
> 
>  multiply([I)allowed should be succsessful
> ***************** test multiply([I)******************
> Got result : 362880
> 
>  multiply([I[I)allowed should fail
> ****************** test multiply[I[I *******************
> FAILEURE org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object;
> -> int)
> - FAILEURE
> AxisFault
>  faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode:
>  faultString: org.xml.sax.SAXException: Bad types (class
> [Ljava.lang.Object; -&gt; int)
>  faultActor:
>  faultNode:
>  faultDetail:
> 	{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Bad
> types (class [Ljava.lang.Object; -&gt; int)
	at
> org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:317)
	at
>
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1031)
	at
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
	at
> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:845)
	at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
	at
> org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
	at
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:184)
	at
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:334)
	at
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
	at
> org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
	at
> org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
	at
> org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:485)
	at
> org.apache.axis.server.AxisServer.invoke(AxisServer.java:324)
	at
> org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:435)
	at
> org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:190)
	at
> java.lang.Thread.run(Thread.java:536)

> 
> org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> int)
> 	at
> org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
> 	at
> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
> 	at
>
org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1083)
> 	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
> Source)
> 	at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
> Source)
> 	at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> 	at
> 
=== message truncated ===> --- ./patch/ServiceDesc.java	2003-07-29 08:35:19.000000000 +0600
> +++ ServiceDesc.java	2003-07-29 08:18:45.000000000 +0600
> @@ -590,6 +590,20 @@
>          // javaTypes of the Method parameters.
>          //
>          // ------------------------------------------------
> +		
> +		//TODO this is new
> +			   /*
> +				   if the method not allowed we will do nothing
> +			   */
> +			   if (oper != null && implClass != null) {
> +				   List inParam = oper.getAllInParams();
> +				   Class[] params = new Class[inParam.size()];
> +				   for (int i = 0; i < params.length; i++) {
> +					   params[i] = ((ParameterDesc) inParam.get(i)).getJavaType();
> +				   }
> +				   if (!this.isAllowedMethod(params, oper.getName()))
> +					   return;
> +			   }
>  
>          // If we're already mapped to a Java method, no need to do anything.
>          if (oper.getMethod() != null)
> @@ -957,12 +971,15 @@
>          // If we're done introspecting, or have completed this method, return
>          if (completedNames == null || completedNames.contains(methodName))
>              return;
> -
> +//TODO remove this this will check by my code
> +/*
>          // Skip it if it's not a sanctioned method name
>          if ((allowedMethods != null) &&
>              !allowedMethods.contains(methodName))
>              return;
>  
> +*/
> +
>          if ((disallowedMethods != null) &&
>              disallowedMethods.contains(methodName))
>              return;
> @@ -1081,6 +1098,13 @@
>       * if not.
>       */
>      private void createOperationForMethod(Method method) {
> +		
> +		//TODO this is new
> +		  //if the method is not allowed we will simply return
> +		if ((method != null) &&
> +			   !isAllowedMethod(method.getParameterTypes(), method.getName()))
> +			   return;
> +
>          // If we've already got it, never mind
>          if (method2OperationMap.get(method) != null) {
>              return;
> @@ -1354,4 +1378,82 @@
>      public void setTypeMappingRegistry(TypeMappingRegistry tmr) {
>          this.tmr = tmr;
>      }
> +	/**
> +	 * Check a given method descriptions wheather it is an allowed method.
> +	 * the allowed methods are specified in the wsdd file using the JNI standreads.
> +	 *
> +	 * Signature Java Programming Language Type
> +		Z - boolean
> +		B - byte
> +		C - char
> +		S - short
> +		I - int
> +		J - long
> +		F - float
> +		D - double
> +		L fully-qualified-class;  fully-qualified-class
> +		[ type - type[]
> +
> +	 eg:- add(int a,int b) is add(II)
> +		  getValue(SOAPHeaderElement[] headers) is
> getValue([Lorg.apache.axis.message.SOAPHeaderElement)
> +
> +	 the convention used is
> +	 method-name(attlist-in-jni)
> +
> +	 * @param param
> +	 * @param methodName
> +	 * @return
> +	 */
> +
> +	private boolean isAllowedMethod(Class[] param, String methodName) {
> +        if(this.allowedMethods == null) return true; //if allowed methods are null that means
> all are allowed
> +		if (methodName != null) {
> +			//if () is not added the it is considered to be using the old convension (No parameters) and
> will return true. Do we need that ???
> +			if ((param == null || param.length == 0) || (this.allowedMethods.contains(methodName) ||
> this.allowedMethods.contains(methodName + "()")))
> +				return true;
> +			else {
> +				StringBuffer name = new StringBuffer();
> +				name.append(methodName + "(");
> +				for (int i = 0; i < param.length; i++) {
> +					className2JNIName(param[i], name);
> +				}
> +				name.append(")");
> +				if (this.allowedMethods.contains(name.toString()))
> +					return true;
> +			}
> +		}
> +		return false;
> +	}
> +
> +	/**
> +	 * This is a convinence method. It checks each parameter and append correct string to the
> buffer
> +	 * @param param
> +	 * @param name
> +	 */
> +	private void className2JNIName(Class param, StringBuffer name) {
> +		if (param.isArray()) {
> +			name.append("[");
> +			className2JNIName(param.getComponentType(), name);
> +		} else if (param.getName().equals("boolean")) {
> +			name.append("Z");
> +		} else if (param.getName().equals("byte")) {
> +			name.append("B");
> +		} else if (param.getName().equals("char")) {
> +			name.append("C");
> +		} else if (param.getName().equals("short")) {
> +			name.append("S");
> +		} else if (param.getName().equals("int")) {
> +			name.append("I");
> +		} else if (param.getName().equals("long")) {
> +			name.append("J");
> +		} else if (param.getName().equals("float")) {
> +			name.append("F");
> +		} else if (param.getName().equals("double")) {
> +			name.append("D");
> +		} else {
> +			name.append("L" + param.getName());
> +		}
> +	}
>  }
> +
> +
> 

> ATTACHMENT part 3 application/x-tar name=test-case.tar



=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com