You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Christian Kaps <ch...@mohiva.com> on 2012/11/30 09:25:39 UTC
Problems generating the client for the ClickandBuy API
Hi,
I have problems to generate the client for the ClickandBuy API using
xmlbeans. The WSDL is located online under the address:
https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl.
The command that I use is as follows:
$AXIS2_HOME/bin/wsdl2java.sh -o clickandbuy-src -uri
https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl -p
com.clickandbuy.api -d xmlbeans -s
The output is as follows:
Using AXIS2_HOME: /data/development/bin/java/axis2/latest
Using JAVA_HOME: /etc/java-config-2/current-system-vm
Retrieving document at
'https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl'.
Retrieving schema at
'https://api.clickandbuy.com/webservices/pay_1_1_0.xsd', relative to
'https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl'.
Retrieving schema at
'https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd', relative
to 'https://api.clickandbuy.com/webservices/pay_1_1_0.xsd'.
Retrieving schema at
'https://api.clickandbuy.com/webservices/SOAPTypes_1_1_0.xsd', relative
to 'https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd'.
[INFO] Resolving schema with publicId
[http://api.clickandbuy.com/webservices/pay_1_1_0/] and systemId
[https:/api.clickandbuy.com/webservices/pay_1_1_0.xsd]
[INFO] Resolving schema with publicId [null] and systemId
[https:/api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd]
Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:50)
at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:126)
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:246)
... 2 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:115)
... 3 more
Caused by: java.lang.RuntimeException:
org.apache.xmlbeans.XmlException:
https://api.clickandbuy.com/webservices/pay_1_1_0.xsd:2:1: error:
Problem parsing referenced XML resource -
https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd:1:1: error:
Unexpected end of file after null
at
org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:325)
... 8 more
Caused by: org.apache.xmlbeans.XmlException:
https://api.clickandbuy.com/webservices/pay_1_1_0.xsd:2:1: error:
Problem parsing referenced XML resource -
https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd:1:1: error:
Unexpected end of file after null
at
org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:226)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
at
org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:189)
... 8 more
If I download the WSDL and the XSD files then I can create the
client(after fixing an other error; see below). It seems that Axis
appends arbitrary data to the XSD files during download!? Can this be
the case?
The other problem is that Axis stumbled upon a invalid regular
expression which I think isn't invalid.
The regular expression 'GMT[+-][012]?\d(:[0-5]\d)?' is malformed: '-'
is an invalid character range. Write '\-'.
I think the hyphen needn't be escaped in a character set. If you look
at the http://www.regular-expressions.info/charclass.html under the
point "Metacharacters Inside Character Classes" there exists an example
for this case. Both [-x] and [x-] match an x or a hyphen.
I have tested this with 1.6.2 and with trunk.
Best regards,
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Problems generating the client for the ClickandBuy API
Posted by Sagara Gunathunga <sa...@gmail.com>.
As you can see in the error log this is a Xmlbeans specific issue
issue, you can use default ADB or JAXB data binding without any issue.
axis2-1.6.2/bin/wsdl2java.sh -uri
https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl -p
com.clickandbuy.api
axis2-1.6.2/bin/wsdl2java.sh -uri
https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl -p
com.clickandbuy.api -d jaxbri
Thanks !
On Fri, Nov 30, 2012 at 1:55 PM, Christian Kaps
<ch...@mohiva.com> wrote:
> Hi,
>
> I have problems to generate the client for the ClickandBuy API using
> xmlbeans. The WSDL is located online under the address:
> https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl.
> The command that I use is as follows:
> $AXIS2_HOME/bin/wsdl2java.sh -o clickandbuy-src -uri
> https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl -p
> com.clickandbuy.api -d xmlbeans -s
>
> The output is as follows:
> Using AXIS2_HOME: /data/development/bin/java/axis2/latest
> Using JAVA_HOME: /etc/java-config-2/current-system-vm
> Retrieving document at
> 'https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl'.
> Retrieving schema at
> 'https://api.clickandbuy.com/webservices/pay_1_1_0.xsd', relative to
> 'https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl'.
> Retrieving schema at
> 'https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd', relative to
> 'https://api.clickandbuy.com/webservices/pay_1_1_0.xsd'.
> Retrieving schema at
> 'https://api.clickandbuy.com/webservices/SOAPTypes_1_1_0.xsd', relative to
> 'https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd'.
> [INFO] Resolving schema with publicId
> [http://api.clickandbuy.com/webservices/pay_1_1_0/] and systemId
> [https:/api.clickandbuy.com/webservices/pay_1_1_0.xsd]
> [INFO] Resolving schema with publicId [null] and systemId
> [https:/api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd]
> Exception in thread "main"
> org.apache.axis2.wsdl.codegen.CodeGenerationException:
> java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
> at
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293)
> at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:50)
> at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
> Caused by: java.lang.RuntimeException:
> java.lang.reflect.InvocationTargetException
> at
> org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:126)
> at
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:246)
> ... 2 more
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:115)
> ... 3 more
> Caused by: java.lang.RuntimeException: org.apache.xmlbeans.XmlException:
> https://api.clickandbuy.com/webservices/pay_1_1_0.xsd:2:1: error: Problem
> parsing referenced XML resource -
> https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd:1:1: error:
> Unexpected end of file after null
> at
> org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:325)
> ... 8 more
> Caused by: org.apache.xmlbeans.XmlException:
> https://api.clickandbuy.com/webservices/pay_1_1_0.xsd:2:1: error: Problem
> parsing referenced XML resource -
> https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd:1:1: error:
> Unexpected end of file after null
> at
> org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:226)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
> at
> org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:189)
> ... 8 more
>
> If I download the WSDL and the XSD files then I can create the client(after
> fixing an other error; see below). It seems that Axis appends arbitrary data
> to the XSD files during download!? Can this be the case?
>
> The other problem is that Axis stumbled upon a invalid regular expression
> which I think isn't invalid.
> The regular expression 'GMT[+-][012]?\d(:[0-5]\d)?' is malformed: '-' is an
> invalid character range. Write '\-'.
>
> I think the hyphen needn't be escaped in a character set. If you look at the
> http://www.regular-expressions.info/charclass.html under the point
> "Metacharacters Inside Character Classes" there exists an example for this
> case. Both [-x] and [x-] match an x or a hyphen.
>
> I have tested this with 1.6.2 and with trunk.
>
> Best regards,
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
--
Sagara Gunathunga
Blog - http://ssagara.blogspot.com
Web - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Problems generating the client for the ClickandBuy API
Posted by Sagara Gunathunga <sa...@gmail.com>.
On Mon, Dec 3, 2012 at 8:34 PM, andrei <an...@martchouk.com> wrote:
> Hi Christian,
>
> I never tried to generate client classes with axis2 before, because I
> successfully used Apache CXF for this purpose. For now I tried the
> generation with axis2 and run into the same troubles described by you.
Well how do you claim the issue with Axis2 :)
For Axis2 you have used "xmlbeans" as the data binding but for CXF you
tried with "JAXB"[1] not "xmlbeans" if you use "xmlbeans" with CXF
you will end up with same result.
apache-cxf-2.6.2/bin/wsdl2java -db xmlbeans
https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl
WSDLToJava Error: Error generating XMLBeans types
https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd:1985:7:
error: pattern-regex: The regular expression
'GMT[+-][012]?\d(:[0-5]\d)?' is malformed: '-' is an invalid character
range. Write '\-'.:
https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd[1985,7]
In fact if someone pay little more attention on axis2 error log it is
very straightforward to identify the actual issue with Xmlbeans
itself.
Caused by: org.apache.xmlbeans.XmlException:
https://api.clickandbuy.com/webservices/pay_1_1_0.xsd:2:1: error:
Problem parsing referenced XML resource -
https://api.clickandbuy.com/webservices/PayTypes_1_1_0.xsd:1:1: error:
Unexpected end of file after null
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
at org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:189)
If you used Axis2 default databinding (ADB) or jaxbri (which used by
CXF by default) you can generate Axis2 codes successfully.
axis2-1.6.2/bin/wsdl2java.sh -uri
https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl -p
com.clickandbuy.api
axis2-1.6.2/bin/wsdl2java.sh -uri
https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl -p
com.clickandbuy.api -d jaxbri
Next time you need to do more home works before you suggest
alternatives on a project specific mailing list.
[1] - https://raw.github.com/martchouk/clickandbuy.api.java/master/clickandbuy.api.java/clickandbuy.api.soap.cfx/pom.xml
Thanks !
>
> Here you can find a working example using Maven, Apache CXF and Spring WS to
> generate and use a SOAP client for ClickandBuy payment API:
> https://github.com/martchouk/clickandbuy.api.java
>
> Maybe you can use this way until the axis way will be fixed.
> Just checkout the whole project and run "mvn clean test", it will generate
> the client stub classes and run the test client against the ClickandBuy
> sandbox environment, the generated classes you'll find in
> clickandbuy.api.soap.cfx/src/main/generated/ .
>
> In case you want only to generate the client classes, run "mvn clean
> install", then go into clickandbuy.api.soap.cfx and run "mvn clean
> cxf-codegen:wsdl2java" there.
>
> The only piece of java coded manualy is the test class where you can see how
> to call the generated client classes:
> https://github.com/martchouk/clickandbuy.api.java/blob/master/clickandbuy.api.java/clickandbuy.api.soap.cfx/src/test/java/clickandbuy/api/soap/cxf/ClickandbuyApiSoapCfxClientTest.java
> , in the test class only one API call is implemented(payRequest call), the
> rest you have to add yourself in the same way.
>
> The test data you can change in the property file, and of course you need
> your own secretKey and further auth data from your ClickandBuy merchant
> (sandbox)account:
> https://github.com/martchouk/clickandbuy.api.java/blob/master/clickandbuy.api.java/clickandbuy.api.soap.cfx/src/test/resources/clickandbuy.api.SANDBOX.properties
>
> Enjoy
> Andrei
>
>
>
>
>
> --
> View this message in context: http://axis.8716.n7.nabble.com/Problems-generating-the-client-for-the-ClickandBuy-API-tp110807p110813.html
> Sent from the Axis Java - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
--
Sagara Gunathunga
Blog - http://ssagara.blogspot.com
Web - http://people.apache.org/~sagara/
LinkedIn - http://www.linkedin.com/in/ssagara
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Problems generating the client for the ClickandBuy API
Posted by andrei <an...@martchouk.com>.
Hi Christian,
I never tried to generate client classes with axis2 before, because I
successfully used Apache CXF for this purpose. For now I tried the
generation with axis2 and run into the same troubles described by you.
Here you can find a working example using Maven, Apache CXF and Spring WS to
generate and use a SOAP client for ClickandBuy payment API:
https://github.com/martchouk/clickandbuy.api.java
Maybe you can use this way until the axis way will be fixed.
Just checkout the whole project and run "mvn clean test", it will generate
the client stub classes and run the test client against the ClickandBuy
sandbox environment, the generated classes you'll find in
clickandbuy.api.soap.cfx/src/main/generated/ .
In case you want only to generate the client classes, run "mvn clean
install", then go into clickandbuy.api.soap.cfx and run "mvn clean
cxf-codegen:wsdl2java" there.
The only piece of java coded manualy is the test class where you can see how
to call the generated client classes:
https://github.com/martchouk/clickandbuy.api.java/blob/master/clickandbuy.api.java/clickandbuy.api.soap.cfx/src/test/java/clickandbuy/api/soap/cxf/ClickandbuyApiSoapCfxClientTest.java
, in the test class only one API call is implemented(payRequest call), the
rest you have to add yourself in the same way.
The test data you can change in the property file, and of course you need
your own secretKey and further auth data from your ClickandBuy merchant
(sandbox)account:
https://github.com/martchouk/clickandbuy.api.java/blob/master/clickandbuy.api.java/clickandbuy.api.soap.cfx/src/test/resources/clickandbuy.api.SANDBOX.properties
Enjoy
Andrei
--
View this message in context: http://axis.8716.n7.nabble.com/Problems-generating-the-client-for-the-ClickandBuy-API-tp110807p110813.html
Sent from the Axis Java - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org