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 Jongjin Choi <gu...@hotmail.com> on 2004/07/05 17:13:08 UTC

JavaServiceImplWriter problem (port QName)

Hi.
 
Currently the code generated by the JavaServiceImplWriter seems not to
keep the qname of port in the WSDL.
 
Using Java2Wsdl with this wsdl
http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl which has
the wsdl:service like this:
 
 
<service name='net.xmethods.services.stockquote.StockQuoteService'>
  <documentation>net.xmethods.services.stockquote.StockQuote web
service</documentation>
  <port name='net.xmethods.services.stockquote.StockQuotePort' 
       binding='tns:net.xmethods.services.stockquote.StockQuoteBinding'>
     <soap:address location='http://64.124.140.30:9090/soap'/>
   </port>
</service>
 
 
the generated Service Locator code is:
 
 
    // The WSDD service name defaults to the port name.
    private java.lang.String
NetXmethodsServicesStockquoteStockQuotePortWSDDServiceName = 
                "NetXmethodsServicesStockquoteStockQuotePort";  <--- (1)

    public stock.NetXmethodsServicesStockquoteStockQuotePortType
getNetXmethodsServicesStockquoteStockQuotePort(java.net.URL portAddress)
throws javax.xml.rpc.ServiceException {
        try {
            stock.NetXmethodsServicesStockquoteStockQuoteBindingStub _stub =
new stock.NetXmethodsServicesStockquoteStockQuoteBindingStub(portAddress,
this);
 
_stub.setPortName(getNetXmethodsServicesStockquoteStockQuotePortWSDDServiceN
ame());   <--- (3)
            return _stub;
        }
        catch (org.apache.axis.AxisFault e) {
            return null;
        }
    }
 
public java.util.Iterator getPorts() {
        if (ports == null) {
            ports = new java.util.HashSet();
            ports.add(new
javax.xml.namespace.QName("NetXmethodsServicesStockquoteStockQuotePort"));
<-- (2) 
        }
        return ports.iterator();
    }
 
 
 
 
The javified port QName is used in (1), (2) and the port name for _stub is
set using this javified name in (3).
 
So we can not set up client JAX-RPC handler code using the name in the WSDL.

When settng up client JAX-RPC handler, the developer should know the
javified name by inspecting the generated Locator code like this:
 
 
HandlerRegistry reg = service.getHandlerRegistry();
QName portName 
       = new
QName("http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.
StockQuote/", 
           "NetXmethodsServicesStockquoteStockQuotePort");   // <-- Javified
Name
 
List list = new ArrayList();
list.add(new HandlerInfo(ClientHandler.class, null, null));
reg.setHandlerChain(portName, list);
 
 
 
I think that the developer can use the wsdl port name directly instead of
inspecting the Axis-generated code like this:
 
 
 
HandlerRegistry reg = service.getHandlerRegistry();
  QName portName = new
QName("http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.
StockQuote/", 
     "net.xmethods.services.stockquote.StockQuotePort");   // <-- xml name
in WSDL
 
 
 
I made a some modification in the JavaServiceImplWriter and it worked. 
I'd like the axis committer to check and apply this fix.
The diff with the currently Axis cvs code is following:
 
--------------------------------------------------------------------
 
cvs -q diff JavaServiceImplWriter.java (in directory
D:\src\ws-axis\java\src\org\apache\axis\wsdl\toJava\)
Index: JavaServiceImplWriter.java
===================================================================
RCS file:
/home/cvspublic/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImpl
Writer.java,v
retrieving revision 1.37
diff -r1.37 JavaServiceImplWriter.java
100a101
>         Vector getPortPortXmlNames = new Vector();
153a155
>             String portXmlName = p.getName();
174a177
>             getPortPortXmlNames.add(portXmlName);
241c244
<             writeWSDDServiceNameInfo(pw, wsddServiceName, portName);
---
>             writeWSDDServiceNameInfo(pw, wsddServiceName, portName,
portXmlName);
250c253
<         writeGetPortQNameClass(pw, getPortPortNames);
---
>         writeGetPortQNameClass(pw, getPortPortNames, getPortPortXmlNames);
252c255
<         writeGetPorts(pw, getPortPortNames);
---
>         writeGetPorts(pw, sEntry.getQName().getNamespaceURI(),
getPortPortXmlNames);
292c295
<                                             String portName) {
---
>                                             String portName, String
portXmlName) {
297c300
<                 + portName + "\";");
---
>                 + portXmlName + "\";");        
464c467,468
<                                           Vector getPortPortNames) {
---
>                                           Vector getPortPortNames,
>             Vector getPortPortXmlNames) {
481a486
>             String portXmlName = (String) getPortPortXmlNames.get(i);
483c488
<             pw.println("if (\"" + portName + "\".equals(inputPortName))
{");
---
>             pw.println("if (\"" + portXmlName + "\".equals(inputPortName))
{");
520c525
<     protected void writeGetPorts(PrintWriter pw, Vector portNames) {
---
>     protected void writeGetPorts(PrintWriter pw, String namespaceURI,
Vector portNames) {
529,530c534,535
<             pw.println("            ports.add(new
javax.xml.namespace.QName(\""
<                     + portNames.get(i) + "\"));");
---
>             pw.println("            ports.add(new
javax.xml.namespace.QName(\"" + 
>                     namespaceURI + "\", \"" + portNames.get(i) + "\"));");
 
***** CVS exited normally with code 1 *****
 
 
 
 
 
 
 
 

 
 
 

Re: JavaServiceImplWriter problem (port QName)

Posted by Davanum Srinivas <da...@gmail.com>.
Applied your patch. please check latest cvs.

-- dims


----- Original Message -----
From: Jongjin Choi <gu...@hotmail.com>
Date: Tue, 6 Jul 2004 00:13:08 +0900
Subject: JavaServiceImplWriter problem (port QName)
To: axis-dev@ws.apache.org







Hi.

 

Currently the 
code generated by the JavaServiceImplWriter 
seems not to

keep the qname of port 
in the WSDL.

 

Using Java2Wsdl with 
this wsdl

http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl which 
has the wsdl:service like this:

 

 

<service 
name='net.xmethods.services.stockquote.StockQuoteService'>

  
<documentation>net.xmethods.services.stockquote.StockQuote web 
service</documentation>

  <port 
name='net.xmethods.services.stockquote.StockQuotePort' 

       
binding='tns:net.xmethods.services.stockquote.StockQuoteBinding'>

     <soap:address 
location='http://64.124.140.30:9090/soap'/>

   
</port>

</service>

 

 

the generated Service 
Locator code is:

 

 

    // 
The WSDD service name defaults to the port name.
    private 
java.lang.String NetXmethodsServicesStockquoteStockQuotePortWSDDServiceName = 


                
"NetXmethodsServicesStockquoteStockQuotePort";  <--- 
(1)


    
public stock.NetXmethodsServicesStockquoteStockQuotePortType 
getNetXmethodsServicesStockquoteStockQuotePort(java.net.URL portAddress) throws 
javax.xml.rpc.ServiceException {
        
try {
            
stock.NetXmethodsServicesStockquoteStockQuoteBindingStub _stub = new 
stock.NetXmethodsServicesStockquoteStockQuoteBindingStub(portAddress, 
this);
            
_stub.setPortName(getNetXmethodsServicesStockquoteStockQuotePortWSDDServiceName());
<--- 
(3)
            return 
_stub;
        
}
        catch (org.apache.axis.AxisFault 
e) {
            
return null;
        
}
    }

 

public 
java.util.Iterator getPorts() {
        if 
(ports == null) 
{
            ports = 
new 
java.util.HashSet();
            
ports.add(new 
javax.xml.namespace.QName("NetXmethodsServicesStockquoteStockQuotePort"));  
<-- (2) 
        
}
        return 
ports.iterator();
    }

 

 

 

 

The javified port QName 
is used in (1), (2) and the port name for _stub is set using this javified name 
in (3).

 

So we can not set 
up client JAX-RPC handler code using the name in the WSDL. 


When settng up client 
JAX-RPC handler, the developer should know the javified name by inspecting the 
generated Locator code like this:

 

 

HandlerRegistry reg = 
service.getHandlerRegistry();
QName portName 

       = new QName("http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/",

           "NetXmethodsServicesStockquoteStockQuotePort");   
// <-- Javified Name

 

List list = new 
ArrayList();
list.add(new HandlerInfo(ClientHandler.class, null, 
null));
reg.setHandlerChain(portName, list);

 

 

 

I think that the 
developer can use the wsdl port name directly instead of inspecting the 
Axis-generated code like this:

 

 

 

HandlerRegistry reg = service.getHandlerRegistry();
  QName 
portName = new QName("http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/",


     
"net.xmethods.services.stockquote.StockQuotePort");   // <-- xml 
name in WSDL

 

 

 

I made a some modification in the JavaServiceImplWriter and it worked. 


I'd like the axis committer to check and apply this 
fix.

The diff with the currently Axis cvs code is 
following:

 

--------------------------------------------------------------------

 

cvs -q diff 
JavaServiceImplWriter.java (in directory 
D:\src\ws-axis\java\src\org\apache\axis\wsdl\toJava\)
Index: 
JavaServiceImplWriter.java
===================================================================
RCS 
file: 
/home/cvspublic/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
retrieving 
revision 1.37
diff -r1.37 
JavaServiceImplWriter.java
100a101
>         
Vector getPortPortXmlNames = new 
Vector();
153a155
>             
String portXmlName = 
p.getName();
174a177
>             
getPortPortXmlNames.add(portXmlName);
241c244
<             
writeWSDDServiceNameInfo(pw, wsddServiceName, 
portName);
---
>             
writeWSDDServiceNameInfo(pw, wsddServiceName, portName, 
portXmlName);
250c253
<         
writeGetPortQNameClass(pw, 
getPortPortNames);
---
>         
writeGetPortQNameClass(pw, getPortPortNames, 
getPortPortXmlNames);
252c255
<         
writeGetPorts(pw, 
getPortPortNames);
---
>         
writeGetPorts(pw, sEntry.getQName().getNamespaceURI(), 
getPortPortXmlNames);
292c295
<                                             
String portName) 
{
---
>                                             
String portName, String portXmlName) 
{
297c300
<                 
+ portName + 
"\";");
---
>                 
+ portXmlName + "\";");        

464c467,468
<                                           
Vector getPortPortNames) 
{
---
>                                           
Vector getPortPortNames,
> 
            Vector 
getPortPortXmlNames) 
{
481a486
>             
String portXmlName = (String) 
getPortPortXmlNames.get(i);
483c488
<             
pw.println("if (\"" + portName + "\".equals(inputPortName)) 
{");
---
>             
pw.println("if (\"" + portXmlName + "\".equals(inputPortName)) 
{");
520c525
<     protected void 
writeGetPorts(PrintWriter pw, Vector portNames) 
{
---
>     protected void 
writeGetPorts(PrintWriter pw, String namespaceURI, Vector portNames) 
{
529,530c534,535
<             
pw.println("            
ports.add(new 
javax.xml.namespace.QName(\""
<                     
+ portNames.get(i) + 
"\"));");
---
>             
pw.println("            
ports.add(new javax.xml.namespace.QName(\"" + 

>                     
namespaceURI + "\", \"" + portNames.get(i) + 
"\"));");

 

***** CVS exited normally with 
code 1 *****

 

 

 

 

 

 

 

 




 

 

 




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

Re: JavaServiceImplWriter problem (port QName)

Posted by Davanum Srinivas <da...@gmail.com>.
Jongjin,

Can you please submit a "cvs diff -u" to our bug database?
(http://issues.apache.org/jira/)

thanks,
dims


----- Original Message -----
From: Jongjin Choi <gu...@hotmail.com>
Date: Tue, 6 Jul 2004 00:13:08 +0900
Subject: JavaServiceImplWriter problem (port QName)
To: axis-dev@ws.apache.org







Hi.

 

Currently the 
code generated by the JavaServiceImplWriter 
seems not to

keep the qname of port 
in the WSDL.

 

Using Java2Wsdl with 
this wsdl

http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl which 
has the wsdl:service like this:

 

 

<service 
name='net.xmethods.services.stockquote.StockQuoteService'>

  
<documentation>net.xmethods.services.stockquote.StockQuote web 
service</documentation>

  <port 
name='net.xmethods.services.stockquote.StockQuotePort' 

       
binding='tns:net.xmethods.services.stockquote.StockQuoteBinding'>

     <soap:address 
location='http://64.124.140.30:9090/soap'/>

   
</port>

</service>

 

 

the generated Service 
Locator code is:

 

 

    // 
The WSDD service name defaults to the port name.
    private 
java.lang.String NetXmethodsServicesStockquoteStockQuotePortWSDDServiceName = 


                
"NetXmethodsServicesStockquoteStockQuotePort";  <--- 
(1)


    
public stock.NetXmethodsServicesStockquoteStockQuotePortType 
getNetXmethodsServicesStockquoteStockQuotePort(java.net.URL portAddress) throws 
javax.xml.rpc.ServiceException {
        
try {
            
stock.NetXmethodsServicesStockquoteStockQuoteBindingStub _stub = new 
stock.NetXmethodsServicesStockquoteStockQuoteBindingStub(portAddress, 
this);
            
_stub.setPortName(getNetXmethodsServicesStockquoteStockQuotePortWSDDServiceName());
<--- 
(3)
            return 
_stub;
        
}
        catch (org.apache.axis.AxisFault 
e) {
            
return null;
        
}
    }

 

public 
java.util.Iterator getPorts() {
        if 
(ports == null) 
{
            ports = 
new 
java.util.HashSet();
            
ports.add(new 
javax.xml.namespace.QName("NetXmethodsServicesStockquoteStockQuotePort"));  
<-- (2) 
        
}
        return 
ports.iterator();
    }

 

 

 

 

The javified port QName 
is used in (1), (2) and the port name for _stub is set using this javified name 
in (3).

 

So we can not set 
up client JAX-RPC handler code using the name in the WSDL. 


When settng up client 
JAX-RPC handler, the developer should know the javified name by inspecting the 
generated Locator code like this:

 

 

HandlerRegistry reg = 
service.getHandlerRegistry();
QName portName 

       = new QName("http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/",

           "NetXmethodsServicesStockquoteStockQuotePort");   
// <-- Javified Name

 

List list = new 
ArrayList();
list.add(new HandlerInfo(ClientHandler.class, null, 
null));
reg.setHandlerChain(portName, list);

 

 

 

I think that the 
developer can use the wsdl port name directly instead of inspecting the 
Axis-generated code like this:

 

 

 

HandlerRegistry reg = service.getHandlerRegistry();
  QName 
portName = new QName("http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/",


     
"net.xmethods.services.stockquote.StockQuotePort");   // <-- xml 
name in WSDL

 

 

 

I made a some modification in the JavaServiceImplWriter and it worked. 


I'd like the axis committer to check and apply this 
fix.

The diff with the currently Axis cvs code is 
following:

 

--------------------------------------------------------------------

 

cvs -q diff 
JavaServiceImplWriter.java (in directory 
D:\src\ws-axis\java\src\org\apache\axis\wsdl\toJava\)
Index: 
JavaServiceImplWriter.java
===================================================================
RCS 
file: 
/home/cvspublic/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
retrieving 
revision 1.37
diff -r1.37 
JavaServiceImplWriter.java
100a101
>         
Vector getPortPortXmlNames = new 
Vector();
153a155
>             
String portXmlName = 
p.getName();
174a177
>             
getPortPortXmlNames.add(portXmlName);
241c244
<             
writeWSDDServiceNameInfo(pw, wsddServiceName, 
portName);
---
>             
writeWSDDServiceNameInfo(pw, wsddServiceName, portName, 
portXmlName);
250c253
<         
writeGetPortQNameClass(pw, 
getPortPortNames);
---
>         
writeGetPortQNameClass(pw, getPortPortNames, 
getPortPortXmlNames);
252c255
<         
writeGetPorts(pw, 
getPortPortNames);
---
>         
writeGetPorts(pw, sEntry.getQName().getNamespaceURI(), 
getPortPortXmlNames);
292c295
<                                             
String portName) 
{
---
>                                             
String portName, String portXmlName) 
{
297c300
<                 
+ portName + 
"\";");
---
>                 
+ portXmlName + "\";");        

464c467,468
<                                           
Vector getPortPortNames) 
{
---
>                                           
Vector getPortPortNames,
> 
            Vector 
getPortPortXmlNames) 
{
481a486
>             
String portXmlName = (String) 
getPortPortXmlNames.get(i);
483c488
<             
pw.println("if (\"" + portName + "\".equals(inputPortName)) 
{");
---
>             
pw.println("if (\"" + portXmlName + "\".equals(inputPortName)) 
{");
520c525
<     protected void 
writeGetPorts(PrintWriter pw, Vector portNames) 
{
---
>     protected void 
writeGetPorts(PrintWriter pw, String namespaceURI, Vector portNames) 
{
529,530c534,535
<             
pw.println("            
ports.add(new 
javax.xml.namespace.QName(\""
<                     
+ portNames.get(i) + 
"\"));");
---
>             
pw.println("            
ports.add(new javax.xml.namespace.QName(\"" + 

>                     
namespaceURI + "\", \"" + portNames.get(i) + 
"\"));");

 

***** CVS exited normally with 
code 1 *****

 

 

 

 

 

 

 

 




 

 

 




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