fireAndForget, sendReceive, sendRobust, sendReceiveNonBlocking that takes 
Operation does not care about invalid Namespace
-------------------------------------------------------------------------------------------------------------------------

                 Key: AXIS2-3991
                 URL: https://issues.apache.org/jira/browse/AXIS2-3991
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: client-api
    Affects Versions: 1.3
         Environment: Windows XP, Eclipse 3.3, WebLogic 9.2 (Web Application), 
JDK 1.5, AquaLogic Service Bus (ESB), WebLogic 10 (Service Container) 
            Reporter: Jay Blanton


We are using Axis2 through the ServiceClient and service requests through the 
dynamic features it provides.  We setup all the necessary Options to create an 
instance of ServiceClient by the following method:

    /**
     * Gets the service client.
     * 
     * @return the service client
     */
    private ServiceClient getServiceClient() {
        ServiceClient mSender = null;

        try {
            WebMethod webMethod =
                
(WebMethod)AnnotationsUtils.getMethodAnnotation(getRequestWrapper().getMethodName(),
                    getRequestWrapper().getClientClass(), WebMethod.class);
            WebService webService =
                
(WebService)getRequestWrapper().getClientClass().getAnnotation(WebService.class);
            String endpointInterface =
                PropertiesUtils.getProperty(webService.propertiesFile(),
                    webService.endpointInterface());
            String timeout =
                PropertiesUtils.getProperty(webService.propertiesFile(), 
webService.timeout());
            String envelopeNamespace =
                PropertiesUtils.getProperty(webService.propertiesFile(),
                    webService.envelopeNamespace());
            String portName =
                PropertiesUtils.getProperty(webService.propertiesFile(), 
webService.portName());
            String serviceName =
                PropertiesUtils.getProperty(webService.propertiesFile(), 
webService.serviceName());

            //Setting the options for the service client
            Options options = new Options();
            options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(timeout));
            options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new 
Integer(timeout));
            options.setSoapVersionURI(envelopeNamespace);
            options.setTo(new EndpointReference(endpointInterface));
            options.setExceptionToBeThrownOnSOAPFault(true);
            options.setCallTransportCleanup(true);

            
if(webService.endpointInterface().toUpperCase().startsWith("HTTP:")) {
                options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
            }
            else 
if(webService.endpointInterface().toUpperCase().startsWith("HTTPS:")) {
                options.setTransportInProtocol(Constants.TRANSPORT_HTTPS);
            }

            if((webMethod != null) && 
(StringUtils.isNotEmpty(webMethod.action()))) {
                options.setAction(webMethod.action());
            }

            //Narrowing the service details by retrieving and creating a 
wsdlServiceName
            //and including the portName in the ServiceClient instantiation if 
those
            //values exist.
            QName wsdlServiceName = null;

            if(StringUtils.isNotEmpty(webService.targetNamespace()) &&
                  StringUtils.isNotEmpty(serviceName)) {
                wsdlServiceName = new QName(webService.targetNamespace(), 
serviceName);
            }

            mSender = null;

            if(mockedService) {
                mSender = new ServiceClient();
            }
            else {
                String wsdlUrlString = wsdlUrl.toString();
                AxisService svc = axisServices.get(wsdlUrlString);

                if(svc == null) {
                    svc = AxisService.createClientSideAxisService(wsdlUrl, 
wsdlServiceName,
                            portName, options);

                    EndpointReference endPntRef = options.getTo();

                    if(endPntRef != null) {
                        endPntRef.setAddress(endpointInterface);
                    }
                    else {
                        options.setTo(new EndpointReference(endpointInterface));
                    }

                    axisServices.put(wsdlUrlString, svc);
                }

                mSender = new ServiceClient(null, svc);
            }

            mSender.setOptions(options);
        }
        catch(NumberFormatException e) {
            throw new WebServiceException(e);
        }
        catch(AxisFault e) {
            throw new WebServiceException(e);
        }

        return mSender;
    }

After this returns to us a ServiceClient, we call the following methods that 
include the specific operationName and targetNamespace:

client.fireAndForget(new QName(webService.targetNamespace(),
                        getOperationName()), 
(OMElement)getRequestWrapper().getRequest());
client.sendReceive(new QName(webService.targetNamespace(),
                        getOperationName()), 
(OMElement)getRequestWrapper().getRequest());
client.sendRobust(new QName(webService.targetNamespace(),
                        getOperationName()), 
(OMElement)getRequestWrapper().getRequest());
client.sendReceiveNonBlocking(new QName(webService.targetNamespace(),
                            getOperationName()), 
(OMElement)getRequestWrapper().getRequest(), callback);

The line new QName(webService.targetNamespace(), getOperationName()) creates a 
fully qualified name for the Operation that should exist in the WSDL that was 
used in creating the ServiceClient.  The problem is that I could send null or 
"blah" or any arbitrary string as the targetNamespace and it will create a 
QName based on that namespace...and when that is sent into a method like 
sendReceive...no exception is thrown.  The Operation is found, even though the 
namespace is totally invalid.  For instance, if my operation is not valid...I 
get an exception that the Operation does not exist in the WSDL.  But when the 
Operation name is valid...but the namespace is invalid...it does not throw this 
same error...it doesn't seem to care about the namespace at all.

Thanks - jay

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to