eclipse-ee4j/jax-rpc-ri

A java method name must be compared to a decapitalized wsdl:operation name.

Opened this issue · 4 comments

Hi, jax-rpc developers.

In case wsdl:operation name begin with a upper-case letter as the [Extract1]
WSDL,
the clients, [Extract2] and [Extract4], get the stack straces, [Extract3] and
[Extract5], respectively.

The reason is because, in ConfiguredCall#getPortNameForInterface() and
MethodInfo#matches(), comparing a java method name which always begin with a
lower-case letter to a wsdl:operation name which may begin with a upper-case
letter.
Therefore, I think that a wsdl:operation name should be decapitalized before
the comparison.

And I resolved this issue with the [Extract6].

Thanks.

[Extract1: WSDL]

... ...

[Extract2: Client]
ServiceFactory serviceFactory = ServiceFactory.newInstance();

URL wsdlURL = new URL(...);
QName serviceQName = new QName("urn:Foo", "HelloService");

Service service = serviceFactory.createService(wsdlURL, serviceQName);
HelloIF port = (HelloIF)service.getPort(HelloIF.class);

[Extract4: Stack trace]
service:

{urn:Foo}

HelloService does not contain port: null
at com.sun.xml.rpc.client.dii.ConfiguredService.portNotFoundException
(ConfiguredService.java:155)
at com.sun.xml.rpc.client.dii.ConfiguredService.getPortInfo
(ConfiguredService.java:148)
at com.sun.xml.rpc.client.dii.ConfiguredService.getPort
(ConfiguredService.java:267)
at com.sun.xml.rpc.client.dii.ConfiguredService.getPort
(ConfiguredService.java:167)
at helloservice.client.ejb.Client.main(Client.java:36)

[Extract5: Client]
ServiceFactory serviceFactory = ServiceFactory.newInstance();

URL wsdlURL = new URL(...);
QName serviceQName = new QName("urn:Foo", "HelloService");
QName portQName = new QName("urn:Foo", "HelloIFPort");

Service service = serviceFactory.createService(wsdlURL, serviceQName);
HelloIF port = (HelloIF)service.getPort(portQName, HelloIF.class);

[Extract5: Stack trace]
port:

{urn:Foo}

HelloIFPort does not contain operation: sayHello
at com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall
(ConfiguredCall.java:115)
at com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall
(ConfiguredCall.java:86)
at com.sun.xml.rpc.client.dii.ConfiguredCall.setMethodName
(ConfiguredCall.java:67)
at com.sun.xml.rpc.client.dii.ConfiguredService.getPort
(ConfiguredService.java:267)
at helloservice.client.ejb.Client.main(Client.java:36)
at com.sun.xml.rpc.client.dii.DynamicProxyBuilder.buildDynamicProxyFor
(DynamicProxyBuilder.java:83)

[Extract6: Patch]

      1. Eclipse Workspace Patch 1.0
        #P jaxrpc-ri-cvs
        Index: src/com/sun/xml/rpc/client/dii/MethodInfo.java

        RCS file: /cvs/jax-rpc/jaxrpc-
        ri/src/com/sun/xml/rpc/client/dii/MethodInfo.java,v
        retrieving revision 1.2
        diff -u -r1.2 MethodInfo.java
      • src/com/sun/xml/rpc/client/dii/MethodInfo.java 13 Apr 2006 01:26:47 -
        0000 1.2
        +++ src/com/sun/xml/rpc/client/dii/MethodInfo.java 20 Mar 2007 01:49:08 -
        0000
        @@ -102,7 +102,8 @@
        }

public boolean matches(String methodName, OperationInfo operation) {

  • if (!operation.getName().getLocalPart().equals(methodName)) {

    • if (!com.sun.xml.rpc.processor.util.StringUtils.decapitalize(
    • operation.getName().getLocalPart()).equals(methodName)) { return false; }

    if (method != null) {
    Index: src/com/sun/xml/rpc/client/dii/ConfiguredService.java

    RCS file: /cvs/jax-rpc/jaxrpc-
    ri/src/com/sun/xml/rpc/client/dii/ConfiguredService.java,v
    retrieving revision 1.2
    diff -u -r1.2 ConfiguredService.java

      • src/com/sun/xml/rpc/client/dii/ConfiguredService.java 13 Apr 2006
        01:26:45 -0000 1.2
        +++ src/com/sun/xml/rpc/client/dii/ConfiguredService.java 20 Mar 2007
        01:49:08 -0000
        @@ -194,14 +194,12 @@
        OperationInfo currentOperation =
        (OperationInfo) eachOperation.next();
        // Does the currentOperation name match the method name?
  • if (!currentOperation

  • .getName()

  • .getLocalPart()

  • .equals(methods[i].getName())) {

    • if (!
      com.sun.xml.rpc.processor.util.StringUtils.decapitalize(
    • currentOperation.getName().getLocalPart()).equals
      (methods[i].getName())) { continue; }

    // Does it have the same number of parameters?

  • //not fail proof currentOperation has request and response

    • // not fail proof currentOperation has request and response

Class[] parameters = methods[i].getParameterTypes();
int paramLength = parameters.length;

Environment

Operating System: All
Platform: All

Affected Versions

[current]

@glassfishrobot Commented
Was assigned to jax-rpc-issues

@glassfishrobot Commented
This issue was imported from java.net JIRA JAX_RPC-33