Problems with web service, Axis2 and Rampart - web-services

I'm new with the Web services and I have a problem obtaining the java files from a WSDL.
The devs of the servers gave me this information:
I have to generate the source with a xmlbeans binding using Axis2 and Rampart. The requests must be signed with a trusted certificate (I have one) and add a Timestamp.
That said, I downloaded the lastest versions of Axis2 and Rampart and executed the next command line without getting errors:
wsdl2java -d xmlbeans -uri https://juntadeandalucia.e-factura.net/puef/services/SSPPWebServiceProxyService?wsdl -o .\src\
I don't have a clue about how to configure Rampart (just copied the modules in repository/modules, inside Axis2 directory) and I don't know if it varies the result neither. The case is that, following the Apache web examples, I can't use the java source generated as is.
For example, to use the consultarFactura method I would need to write a source like this, following the Apache web examples:
SSPPWebServiceProxyServiceStub webservice = new
SSPPWebServiceProxyServiceStub(url); ConsultarFacturaDocument doc =
ConsultarFacturaDocument.Factory.newInstance();
doc.setNumeroRegistro(numeroRegistro); return
webservice.consultarFactura(doc); //Return the response
But setNumeroRegistro() its not a method of ConsultarFacturaDocument (witch is an interface), its a method of another interface called ConsultarFactura defined inside the first one.
wsdl2java gave me a wrong or incomplete code?
I have to do something more before generating the code?
Can I use another framework to generate a more clean code? (I tried cxf, but wsdl2java gave me errors, using the xmlbeans binding or not).
Any help would be highly appreciated.
(Sorry for my bad english)

Related

Stub client generation Apache CXF

I am seeing one behavior while accessing one wsdl. I used Apache Axis 1.3 as well as JAX-WS wsimport tool to generate client stubs, it is successfully generating stubs.
But when I am using apache-cxf-2.7.18 and using wsdl2java command, it's not generating stubs, giving me error.
WSDL is on https. I added proxy in wsdl2java bat file as well. wsdl contains a which is also on https.
Error I am getting like:
enter image description here
It seems to that it's not able to include underlying wsdl.
Can anybody give me any pointer what I am doing wrong?
I believe, when I am doing any service publishing, it can not be client implementation specific like it is supported by Axis but not CXF. or I can do that? Is there any restriction that could be applied?
(Solution in comments)
The error log shows a connection error when downloading the WSDL, probably due to a misconfiguration of the proxy in wsdl2java when using a SSL connection through maven
Maven is not is not able to download imports using the proxy configuration, since you have downloaded the wsdl, you can also download all referenced url resources to local files and change <wsdl:import location= to use each local file. Use a relative path ./yourfile or a URL format file://path/to/the/file

Generating a WCF client for MODIS Web Service

I want to create a WCF client for MODIS Web Service available on this website: http://daac.ornl.gov/MODIS/MODIS-menu/modis_webservice.html There is a link to WSDL file, which can I use to generate proxy class. The problem is, that this file is somehow malformed, I cannot create clients with .NET tools like Add Service Reference, wsdl.exe or svcutil.exe. When I try to generate proxy class through website, I get following response:
I've tried to download the WSDL file and create proxy class from local copy, but then I've got this error:
These errors are the same for Add Service Reference and for console output of wsdl.exe and svcutil.exe utils. Is there any other way to create a WCF client to this service or is it impossible in .NET?
EDIT-----
I've managed that the problem occurs, becouse the WSDL is in RPC/Endoded standard and .NET tools cannot handle it properly. I've tried to convert it to Document/literal standard but it's still not working. Can somebody look at my WSDL file and check what I have wrong? It's available under this link: https://wklej.to/67rR7
removing wsdl:documentation blocks inside the element
tags helps to generating codes via svcutil.exe or wsdl.exe.
Baseline for this solution
Hopes this helps.

Create java client from WSDL

I was given a WSDL file as well as the URL of corresponding web service. I know that I must convert the WSDL file to Java classes, using a tool like wsimport. But after that, I am quite lost. How do I write the client code to use these generated classes? I have been googling and still quite not sure about it.
Thanks.
You can use Apache CXF wsdl2java command to convert wsdl file to java file. After that usage is quite simple as follows(and there are may tutorials available):
HelloService service = new HelloService();
Hello client = service.getHelloHttpPort();
String result = client.sayHi("Joe");
WSDL2Java link: http://cxf.apache.org/docs/wsdl-to-java.html
CXF Client Tutorial: http://cxf.apache.org/docs/how-do-i-develop-a-client.html
Thanks.

MSDN web service WSDL not parsing

I am trying to create a web services client for Microsoft's MSDN service (MSTP Content Service). When I use my local IDE to generate the classes it is failing to parse the WSDL from Microsoft published at http://services.msdn.microsoft.com/ContentServices/ContentService.asmx?wsdl and so I tried validating it with a "neutral" validator (XMethods WSDL Validator) and the XMethods validator is saying it cannot parse it with no further significant information. I also tried the eXtc validator and got a similar parse failure. How can I get past this error and create a web services client for MSTP?
I needed code stubs in order to communicate with the MS Content Service System. I used Apache CXF which provides tools for generation of Java or Corba stubs. Apache CXF failed because of a misspelled attribute ("messsage" with 3 s instead of 2):
...
<wsoap12:header messsage="this:AppID" part="AppID" user="literal"/>
...
A download of the formal description file (and correction of misspelled attribute name) wasn't successful because there are further files required for stub generation. I download all missing 14 files.
You could download the WSDL description file and execute the Apache CXF stub generation on this file. This script will abort and print the missing file. So, you have to download this file, manually, and to restart the generation which may abort several times because of further missing files. You can find this files in the schemas folder on the web server, e.g.:
http://services.msdn.microsoft.com/ContentServices/schemas/urn_mtpg_com_mtps_2004_1_image_category_atoms.xsd
http://services.msdn.microsoft.com/ContentServices/schemas/urn_msdn_com_public_content_syndication_2006_09_common.xsd
...
Repeatedly download them and put them into a schemas folder near your WSDL description file.

WSO2 ESB Identity Server and Web Service Client

I'm refering to the following article
http://wso2.com/library/articles/2010/10/using-xacml-fine-grained-authorization-wso2-platform/
I would like to use the sample echoService from the WSO2 AS over a secured proxy in WSO2 ESB in combination with the Identity Server for fine-grained authorization. All the settings mentioned on this page seem to work, however I am stuck concerning the client part. I use NetBeans and the given client code, but the .jars in the classpath there have older versions then the ones in the current version of WSO2 IS, so I started to exchange them manually. Now I get some exceptions like
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init()V
and I am stuck again. I just want to test the echoService in this constellation and send some string over the ESB via IS and receive the response(if I have the appropriate role) from the AS, is there not another client or how could I test it else?
Thank you!
I can suggest you 3 options:
Use SoapUI to test the service which is the easiest way to test a web service.
Generate the stub for the service and have stub as the dependency in your client. You can use the WSDL2Java tool that ship with AS. Loging to AS --> Tools in left pane --> WSDL2Java --> Provide the wsdl URL and generate the stub jar.
Generate correct dependency libs. Go to [IS-Home]/bin folder, and issue that command "ant" to run the build.xml, this will copy all required libs to [IS-HOME]/repository/lib/ folder. Have them in your class path.