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 "Davanum Srinivas (JIRA)" <ji...@apache.org> on 2006/04/17 18:26:18 UTC

[jira] Commented: (AXIS2-566) Multiple ServiceClients using the same configurationContext causes NPE

    [ http://issues.apache.org/jira/browse/AXIS2-566?page=comments#action_12374776 ] 

Davanum Srinivas commented on AXIS2-566:
----------------------------------------

rnell,

We need to fix the NPE...But i think the following  is what you are looking for. Basically you want to avoid reading the wsdl again and again.

    public void test() throws Exception {
        ConfigurationContext configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem( null, null );

        URL wsdlURL = new URL( "http://localhost:8080/axis2/services/version?wsdl" );
        QName serviceName = new QName( "http://ws.apache.org/axis2", "version" );
        String portName = "versionSOAP11port0";
        ServiceClient sender1 = new ServiceClient( configurationContext, wsdlURL, serviceName, portName );
        ServiceClient sender2 = new ServiceClient ( configurationContext, sender1.getAxisService());
    }

thanks,
dims

> Multiple ServiceClients using the same configurationContext causes NPE
> ----------------------------------------------------------------------
>
>          Key: AXIS2-566
>          URL: http://issues.apache.org/jira/browse/AXIS2-566
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: client-api
>     Versions: 0.95
>     Reporter: rnell

>
> This code causes an NPE.  Am I using the API wrong?
> public class MultiServiceClientTest extends TestCase {
>     public MultiServiceClientTest( String name ) {
>         super( name );
>     }
>     public void test() throws Exception {
>         ConfigurationContext configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem( null, null );
>         URL wsdlURL = new URL( "http://localhost:8080/axis2/services/MyService?wsdl" );
>         QName serviceName = new QName( "http://org.apache.axis2/", "MyService" );
>         String portName = "MyServicePortType0";
>         ServiceClient sender1 = new ServiceClient( configurationContext, wsdlURL, serviceName, portName );
>         ServiceClient sender2 = new ServiceClient( configurationContext, wsdlURL, serviceName, portName );
>     }
>     public static void main( String[] args ) {
>         junit.textui.TestRunner.run( new TestSuite( MultiServiceClientTest.class ) );
>     }
> }

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