Author Message
AndersNilsson3
Joined: Nov 5, 2013
Messages: 21
Offline
Hi,

After creating a Axis2 web service from the attached WSDL I get the following two errors in Eclipse:

org.apache.asiomom.OMElement.Factory cannot be resolved

The method serialize(OutputStream, OMOutputFormat) in the type OMNode is not applicable for the arguments (QName, OMFactory, MTOMAwareXMLStreamWriter)

Any suggestions what I can do about it?
Filename ProductInstanceSearch2.wsdl [Disk] Download
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
Quite honestly, I'm somewhat stumped by this one. This is definitely to do with Axis2 itself and the type of Java it generates. Using the command line to create the Java from the WSDL also produces a source file with the same errors. In addition to those errors are warnings that don't show up in OD:


[WARN] Type {http://www.company.com/t2im/entity/Product/v02}ProductInstanceStatus missing!
[WARN] Type {http://www.company.com/t2im/entity/Product/v02}ProductInstanceAdditionalDetails missing!
[WARN] Type {http://www.company.com/t2im/entity/Service/v01}ServiceAccountAdditionalDetails missing!
[WARN] Type {http://www.company.com/t2im/entity/Billing/v02}DirectDebitStatus missing!
[WARN] Type {http://www.company.com/t2im/entity/Billing/v02}BillingAccountStatus missing!
[WARN] Type {http://www.company.com/t2im/entity/Billing/v02}BillingAddress missing!
[WARN] Type {http://www.company.com/t2im/entity/Billing/v02}BillingAccountAdditionalDetails missing!
[WARN] Type {http://www.company.com/t2im/entity/ProductOffering/v01}ProductOfferingAdditionalDetails missing!
[WARN] Type {http://www.company.com/t2im/entity/Product/v02}ProductInstanceAdditionalDetails missing!
[WARN] Type {http://www.company.com/t2im/entity/Party/v02}ParentOrganizationNumber missing!
[WARN] Type {http://www.company.com/t2im/composition/PartyComposition/v03}ContactAdditionalDetails missing!


As well, when I try and use the Axis 1.4 connector, I receive a different issue:


Duplicate file name: C:\tools\OD6\workspace\err\WEB-INF\src\connectivity\ws\beans1\PhoneNumber.java.
Hint: you may have mapped two namespaces with elements of the same name to the same package name.


That happens when there might be namespace issues, and so Axis can't map the same Java file name for two different instances of an element. Even more perplexing than that, using the latest version of Axis2 from Apache's website results in a different issue, though I suspect it is related:


Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
...
Caused by: org.apache.axis2.schema.SchemaCompilationException: The referenced element {http://www.company.com/t2im/Common/v04}StatusName' was not found!

at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:753)
at org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:604)
at org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:2069)
...


As it stands, Axis2, regardless of whether its the OD connector or the standalone binaries, is not able to correctly create Java, or in some cases create Java at all, for the WSDL you're using. There are a couple of options you have: 1) You can try and change the WSDL so that Axis2 is able to read it correctly. This could turn out to be a non-trivial task, though. 2) You can create the Java web service client using a different mechanism, copy that Java file(s) or library into your OD project, and invoke the web service using hand-written Java in a servlet in your flow, rather than using WSOPs. This latter option might be the simplest choice, because even Apache states that the databinding we use, ADB, is:


By no means [...] intended to be a fully functional schema compiler like XMLBeans. [...] ADB is meant to be a 'Simple' databinding framework and was not meant to compile all types of schemas.


I did try using XMLBeans to generate Java using the wsdl2java tool provided with the Axis2 binaries, and it does not generate any errors during the code gen process.
SamareshKowshik
Joined: Nov 6, 2013
Messages: 351
Offline
There was another post this week where Axis2 was also unable to generate the correct Java, which is quite a coincidence, and I had included the command you can use to invoke wsdl2java. The steps are simple, if you haven't done it before.

1. Download Axis2 binaries from Apache. OD/DD use version 1.5.

Axis2 1.5 Download

2. Unzip to a directory.
3. Open a command prompt window and navigate to the /bin directory of your Axis2 unzip.
4. You can move the WSDL file to that /bin directory to make this easier if you wish.
5. Run the following:

wsdl2java.bat -o source -s --noBuildXML -d xmlbeans -uw -p connectivity.ws.beans -uri ./ProductInstanceSearch2.wsdl -or


That'll create the client in a folder titled "source" in the /bin directory.
Go to:   
Mobile view