MEX endpoint for WSO2 Identity Server - java

I am trying to set up an STS test scenario with an STS service, a webservices and a client. The Secure Token Service is from the Identity Server of WSO2 and runs at endpoint
https://[domain]:9443/services/wso2carbon-sts/
the webservice and client are written in java with Netbeans. I run the client and get:
WST0017:Could not obtain STS metadata. MEX call to STS https://[domain]:9443/services/wso2carbon-sts/mex failed.
What is the endpoint of the MEX service of the Secure Token Service in WSO2?

MEX is a protocol that is supposed to help automatically identify the details of the web-service being called. These non-obvious errors tend to happen when the calling library needs the WSDL but is provided with the URL to the endpoint instead. As a result it tries to use MEX to find the WSDL, but since the server does not implement MEX this fails and returns these non-obvious errors.
In practice the fix is almost always to provide the URL to the WSDL (which contains the details of the end point URL) rather than directly to the endpoint. I don't know enough about WSO2, but commonly the WSDL is exposed by appending ?wsdl or similar to the end point URL.

Related

how to create a "https" secured REST API from a SOAP servies in java springboot

I am working on integrating a SOAP service provided by european VAT validation service VIES.
the SOAP service is hosted at following links
https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
I think both of them leads to pretty much same site with one being http and other https
(please let me know if there is a difference).
so I integrated the wsdl into our spring boot application and it worked fine when I tried in in my local host which was http. but as soon as I hosted it in to our live server which is https it started giving error reply.
I searched for possible reasons why it isn't working and ended up with the conclusion that the SOAP services provided by VTES works only in http sites.(let me know if I am wrong)
but when I searched for more solutions I found more sites that provide https secured REST application that uses same SOAP service (https://vatlayer.com/) . We tried to reason with our client to purchase one of those since they only allow a limited number of free VAT validations, but they are not happy with that,
but it got me thinking since they can built a https secured REST API with this thing it means I can do that to. so I searched for a solution but couldn't find any, can anyone please give a insight into it about how it is done.
Thanks and regards.
If you are calling the link from the web browser(client side) and if your live web application runs on HTTPS, then you should also call the SOAP service with HTTPS or otherwise the browser will see it as violating the Same Origin Policy and will block your request.

How to stub wsdl service endpoints?

I want to run some integration tests on a WSDL client application. Therefore I'd like to have the WSDL server (which is not in control of me) to response with the same xml response always.
How could I achieve this? Is there any tool out that offers a wsdl endpoint an can always return the same xml (which I then could take from my live logs)?
SOAPUI offers this functionality. I've used it before with ease.
Alternatively if you do not want to go through the hassle of converting the WSDL request to a meaningful response, take a look at services like mocky which simply echo back a payload.
Take a look at Soap-UI - it has the ability to mock web services exactly as you mentioned using just a wsdl. You can then decide which XML the mocked web service will return, and it will run as a server locally. Instead of pointing to the 'real' server you can then point to your own local endpoint in order to retreive the same response. More information available on my blog here

Axis2 NTLM Authentication for Proxy-Server

What is the correct way to authenticate an Axis2 (Version 1.4) Client at a http proxy server that requires NTLM authentication?
I'm using the following code to provide the proxy credentials, but the authentication still fails (see details at the end):
Options options = serviceStub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.CHUNKED, false);
options.setProperty(HTTPConstants.PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);
ProxyProperties proxyProperties = new ProxyProperties();
proxyProperties.setProxyName("123.123.123.123");
proxyProperties.setProxyPort(8080);
proxyProperties.setUserName("myUser#www.example.org");
proxyProperties.setPassWord("1234");
proxyProperties.setDomain("");
options.setProperty(HTTPConstants.PROXY, proxyProperties);
With exactly the same credentials, a webbrowser, such as Firefox is able to get trough the proxy, so I assume, the proxy server is correctly set up. With the Axis2 client however, the authentication failes (HTTP status code is "407 Proxy Authentication Required").
Further details:
I compared the network traffic from firefox and my client using a network sniffer. The main difference seems to be, that the axis2 client is sending an empty response for the ntlm challenge.
Has anyone successfully authenticated at a http proxy server using NTLM? Can you give me a code example?
I was unable to resolve this problem (with Axis 2). Don't want to blame this on Axis2 tough. Maybe I did something wrong but couldn't figure it out, even after many hours of trying, debugging and reading the docs.
But when I was running out of options I had to look out for other options. This other option came in the form of alternative SOAP-Frameworks. There exist quite a few SOAP frameworks for java. I know about Axis2, CXF and JAX-WS.
Instead of Axis2 I use now JAX-WS. Replacing the frameworks was a straight forward process. A nice side effect of the replacement was, that I got rid of the huge dependency tree, Axis2 comes with. JAX-WS is part of J6EE so there wasn't any need to import other dependencies.
At this time I did the replacement only on the client side. The server still uses Axis2. This combination works great so far, but I still plan to eventually replace Axis2 on the server side too.
All in all: If you do not use a special feature of Axis2, I think, JAX-WS is the better option.

Is it possible to generate code for WS operations from eclipse web services explorer?

I have successfully tested WS operation from eclipse WS explorer. I have problems with programming all the neccessary parameters for WS operation (lots of non Java types). I created my WS client from wizard.
Is it possbile to generate code that would call the same operation as in WS explorer?
If that can't be done, what is the best way to view outgoing SOAP request so i can better see which parameter is null/missing? I am tunneling my connection to the WS endpoint, so i can't see packets with e.g. Wireshark.
You can use TCP/IP monitor of Eclipse to monitor web services.
Check: Using the TCP/IP Monitor to test Web services
You can use SOAPUI to view the soap request and responses. Also you can refer to the section 9.5 of the notes below: -
http://www.slideshare.net/krizsan/scdjws-5-study-notes-3085287

Java web services client

I want to build a web services client that takes wsdl link as the input and generates java classes. I know we can do this directly using Netbeans IDE where we provide the wsdl location during project setup. But I want the wsdl location to be provided when the client starts running. How do I do this?
Is the location that will be provided just used to specify the SOAP endpoint (for a web service whose WSDL was known at development time), or will it be a completely arbitrary WSDL?
In the first case, the web service client that was created by Netbeans has methods that accept an alternate SOAP endpoint URL. You can call those to use the client with a server whose location is not hard-coded in the client.
If however, the WSDL describes a completely unrelated service, how are you going to write Java code against it? You cannot use any interfaces derived from the WSDL (because they are not known at development time). You could only have a very generic SOAP client, where the user almost directly types in the XML that will be sent.

Categories

Resources