Olivier,

In order to use WSDL that contains WSIF bindings (java, ejb, format etc)
you need to register the wsdl extensions for these bindings with the
WSDLReader you use to read the wsdl. The easiest way of doing this is to
use the readWSDL methods on WSIFUtils instead of creating a WSDLReader for
yourself. So for your code you would use:

  Definition wsdlDefinition = WSIFUtils.readWSDL(null, wsdlLocation);
  Service wsdlService = wsdlDefinition.getService(wsdlServiceQName);
  WSIFService wsifService =  wsifFactory.getService(wsdlDefinition,
wsdlService);
  WSIFPort javaPort = wsifService.getPort(javaPortName);

or alternatively, if you want to register the extensions on your own
instance of WSDLReader, you can use:

  wsdlReader.setExtensionRegistry(WSIFUtils.getExtensionRegistry());
  Definition wsdlDefinition = wsdlReader.readWSDL(wsdlLocation);
  Service wsdlService = wsdlDefinition.getService(wsdlServiceQName);
  WSIFService wsifService =  wsifFactory.getService(wsdlDefinition,
wsdlService);
  WSIFPort javaPort = wsifService.getPort(javaPortName);

Regards,
Owen



|---------+---------------------------->
|         |           "Brand, Olivier" |
|         |           <[EMAIL PROTECTED]|
|         |           dafone.com>      |
|         |                            |
|         |           12/03/2003 13:15 |
|         |           Please respond to|
|         |           wsif-user        |
|         |                            |
|---------+---------------------------->
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                                              |
  |       To:       <[EMAIL PROTECTED]>                                                
                                                        |
  |       cc:       <[EMAIL PROTECTED]>                                                
                                                        |
  |       Subject:  Error when retieving Java Port through the WSIF API                
                                                              |
  |                                                                                    
                                                              |
  |                                                                                    
                                                              |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|



The following code throws a NullPointer Exception on any Java ports
described in a WSDL document. Is that operation (getPort) supported for
java ports ?

Definition wsdlDefinition = wsdlReader.readWSDL(wsdlLocation);
Service wsdlService = wsdlDefinition.getService(wsdlServiceQName);
WSIFService wsifService =  wsifFactory.getService(wsdlDefinition,
wsdlService);
WSIFPort javaPort = wsifService.getPort(javaPortName);

Here is the error:

java.lang.NullPointerException
             at
org.apache.wsif.base.WSIFServiceImpl.createDynamicWSIFPort(Unknown Source)
             at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown
Source)
             at
com.vodafone.global.charging.client.JavaStubTest.testWSDLJavaPort(JavaStubTest.java:148)

             at java.lang.reflect.Method.invoke(Native Method)
             at junit.framework.TestCase.runTest(TestCase.java:154)
             at junit.framework.TestCase.runBare(TestCase.java:127)
             at junit.framework.TestResult$1.protect(TestResult.java:106)
             at
junit.framework.TestResult.runProtected(TestResult.java:124)
             at junit.framework.TestResult.run(TestResult.java:109)
             at junit.framework.TestCase.run(TestCase.java:118)
             at junit.framework.TestSuite.runTest(TestSuite.java:208)
             at junit.framework.TestSuite.run(TestSuite.java:203)
             at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:386)

             at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:270)

             at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:161)


And an extract of the createDynamicWSIFPort before the
NullPointerException:

element=[java:operation: null]
BindingOperation: name=getAddressFromName
BindingInput: name=GetAddressFromNameRequest
BindingOutput: name=GetAddressFromNameResponse
UnknownExtensibilityElement
({http://schemas.xmlsoap.org/wsdl/java/}operation):
required=null
element=[java:operation: null]
UnknownExtensibilityElement
({http://schemas.xmlsoap.org/wsdl/java/}binding):
required=null
element=[java:binding: null]
UnknownExtensibilityElement
({http://schemas.xmlsoap.org/wsdl/formatbinding/}typeMapping):
required=null
element=[format:typeMapping: null]
UnknownExtensibilityElement
({http://schemas.xmlsoap.org/wsdl/java/}address):
required=null
element=[java:address: null]

Olivier Brand






Reply via email to