RPCBinding cannot process response message in client mode
---------------------------------------------------------

         Key: XFIRE-307
         URL: http://jira.codehaus.org/browse/XFIRE-307
     Project: XFire
        Type: Bug

  Components: Core  
    Versions: 1.0    
 Environment: jdk1.4.2
    Reporter: Flier Lu
 Assigned to: Dan Diephouse 


    when I create dynamic proxy in client, call proxy method can invoke web 
service method succeeded, but the server response message cannot be processed 
in client side. because when RPCBinding process the server response message,  
it use the local name of response element as operation name, but the server 
response element shold have a "Response" postfix, the operation finding will 
failed.

public class RPCBinding extends WrappedBinding
{
    public void readMessage(InMessage inMessage, MessageContext context) throws 
XFireFault
    {
        DepthXMLStreamReader dr = new 
DepthXMLStreamReader(context.getInMessage().getXMLStreamReader());
        String opName = dr.getLocalName();
        OperationInfo operation = endpoint.getServiceInfo().getOperation( 
opName );
        //...
    }
}

so I add some check for client mode, and use the MessageExchange in context to 
fetch operation, like this

        OperationInfo operation;
        
        if (isClientModeOn(context) && context.getExchange() != null && 
            context.getExchange().getOperation().hasOutput() &&
            
opName.equals(context.getExchange().getOperation().getOutputMessage().getName().getLocalPart()))
        {
          operation = context.getExchange().getOperation();
        }
        else
        {
          operation = endpoint.getServiceInfo().getOperation( opName );
        }       

    this code woke fine in my envrionment, and not broken the unit testcases, 
but I don't known whether are there other method can process this status ?
    I define the web service interface with annotation

/**
 * @@WebService(name = "DeviceWS", serviceName = "DeviceWS", targetNamespace = 
"http://www.nsfocus.com/flowind";)
 * @@SOAPBinding(style = SOAPBindingAnnotation.STYLE_RPC)
 */
public interface DeviceWS
{
  /**
   * @@WebMethod(operationName = "getRouters", action="urn:GetRouters")
   * @@.return WebResult("routers")
   */
  String[] getRouters();
}

and call service

    Service svc = new AnnotationServiceFactory(new CommonsWebAttributes(),
        
XFireFactory.newInstance().getXFire().getTransportManager()).create(DeviceWS.class);
    
    DeviceWS ws = (DeviceWS) new XFireProxyFactory().create(svc, URL_WS + 
"DeviceWS");

   ws.getRouters() //...


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to