Mule http request configuration proxy - web-services

I'm following a tutorial from mulesoft (DataWeave Tutorial) witch implements a Web Service Consumer that calls an external public web service (WSDL). I had no problem to setup the project as described, but when I launch my server I have the following error: "Caused by: java.net.ConnectException: Connection refused: connect".
First thought was that the webservice was unavailable. But I tested it in SoapUI and it workded just fine.
I suppose the error is because the call to the web service is not using the proxy configurations that I have set up in Anypoint Studio. So, in my Web Service Consumer I have set up a HTTP Request Configuration where I added a Proxy Configuration. But it also did not work. Those were my steps:
Web Service Consumer
https://i.stack.imgur.com/hN584.png
References tab
https://i.stack.imgur.com/NIV84.png
HTTP Request Configuration
https://i.stack.imgur.com/Ubpwa.png
Proxy tab
https://i.stack.imgur.com/bBYx1.png
Proxy Configuration
https://i.stack.imgur.com/JDQdf.png
One thing that is immediately noticeable is the the TLS error on the HTTP Request Configuration. This error appears as soon as I choose to use a proxy and when I go to the TLS/SSL tab I have no option to remove the TLS configuration as you can see in the following image:
TLS/SSL tab
https://i.stack.imgur.com/xFqEW.png
Here's the XML of my flow:
<flow name="dataweave_tutorialFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="ex1" doc:name="HTTP" metadata:id="b34a6c34-653f-4b68-8aa3-8292e41a20cf"/>
<dw:transform-message doc:name="Transform Message">
<dw:input-payload doc:sample="C:\temp\dw_example1.json"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/xml
%namespace ns0 http://mulesoft.org/tshirt-service
---
{
ns0#OrderTshirt: {
size: "M" unless payload.buyer.state == "TX" otherwise "XXL",
email: payload.buyer.email,
name: payload.buyer.name,
address1: payload.buyer.address,
address2: null,
city: payload.buyer.city,
stateOrProvince: payload.buyer.state,
postalCode: payload.buyer.postCode,
country: payload.buyer.nationality
}
}]]></dw:set-payload>
</dw:transform-message>
<ws:consumer config-ref="Web_Service_Tshirt" operation="OrderTshirt" doc:name="Web Service Consumer"/>
</flow>
I'm using Anypoint Studio 6.2.5 with Mule ESB Server 3.8.2.
I have no more ideas for what to change to make this work. Hope anyone has some good suggestion about this. Thanks in advance!

You dont require to mention http in proxy url host can set the proxy using following example:-
<http:request-config name="HTTP_Request_Configuration" host="www.webservicex.com" port="80" doc:name="HTTP Request Configuration">
<http:proxy host="my.example.proxy.com" port="8080"/>
</http:request-config>
You may need to provide your proxy username and password based on your proxy.
A best example is if you follow step by step written here :-
http://www.corralict.nl/wsc-connector-proxy/
and
https://docs.mulesoft.com/mule-user-guide/v/3.8/web-service-consumer
Regarding tls, don't touch the tls part and make sure your HTTP request protocol is set to HTTP and not HTTPS. The error you are seeing is a bug in studio and will not affect if you configure rightly.

Related

404 when calling Remedy

I am calling Remedy from WSO2 ESB and I get the following soap error:
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text xmlns="http://ws.apache.org/commons/ns/payload">default backend - 404</text></soapenv:Body></soapenv:Envelope>
I have tested multiples endpoint configurations with no success. If I call the endpoint with straight forward with SoapUI I get the response, but if I go through ESB I get the error. Any help on this error?
Cheers
ESB ports are setup in the <ESB_HOME>/repository/conf/axis2/axis2.xml file:
https://docs.wso2.com/display/ESB470/Setting+Up+Host+Names+and+Ports
I don't see an option for no port, but SOAP uses 80 by default:
What port number does SOAP use?
You can work with your BMC Helix team to setup the ports used by your servers:
https://docs.bmc.com/docs/display/public/helixsubscriber/Network+port+configuration

Getting Soap Fault on hitting a WebService using JMETER

I'm trying to contact a webservice via Jmeter (3.0), and I get the following error:
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="es-AR">The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
I haven't encountered any issues contacting the web service from SoapUI, so I'm wondering what could cause this problem.
You can see the screen shots here:
The HTTP Request within the tree, first part of the HTTP Request data, the HTTP Header Manager settings: https://i.stack.imgur.com/6HxIK.jpg
Here are the results on SoapUI (works just fine):
Results and log
Is it possible that the way that SoapUI sends the requests differs from the way Jmeter does and that's why it works?
Please help. Thanks!
You need to put this action bit to be a part of the Content-Type header like:
I would also recommend adding HTTP Cookie Manager to your Test Plan
Out of interest, why don't you just record the request originated from SoapUI using JMeter HTTP(S) Test Script Recorder like:
Configure JMeter for recording. The easiest way of doing this is using JMeter Templates feature
From JMeter main menu: File - Templates - Recording - Create
Workbench - HTTP(S) Test Script Recorder - Start
Configure SoapUI for recording
From SoapUI main menu: Preferences - Proxy Settings
Proxy Settting: manual, host: IP address or hostname of machine where JMeter is running, port: 8888
Execute request in SoapUI
Inspect the recorded request in JMeter under Workbench -> Recording Controller.
I think you have some trivial error in the value of http header SOAPAction.
Happened to notice(in the image you attached) that there are double quotes in its value.
Just remove the double quotes " from the SOAPAction value.
UPDATE:
It is noticed, while editing the question, that soapui has sent an additional http header action with a value (you masked the value).
So, please add action header in the jmeter request as well the right value in the jmeter plan.

Invoking DataService from wso2 ESB with secure port

I just want to invoke a secure DataService endpoint from wso2 ESB and I couldn't find the right and straight forward solution.
I have seen this and this but no success!
I define my endpoint in ESB as folows:
WSDL Endpoint:
WSDL URI: http://[myIP]:7763/services/PostPaidProviders?wsdl
Service: PostPaidProviders
Port: SecureSOAP11Endpoint
FYI, if I change my Port to 'SOAP11Endpoint' my proxy service on ESB works properly.
Thanks
I've imported my WSO2-DSS's certificate to my ESB keystore from configuration->KeyStores but it still does not work. It seems that it can not validate the host name!
The error was this: "error: Host name verification failed for [MyHostName]"
I added following parameter to the <transportSender name="https part of /repository/conf/axis2/axis2.xml file, restarted the server and it worked :)
<parameter name="HostnameVerifier">AllowAll</parameter>

How to run an ssl EJB Webservice?

I have created an Ejb endpoint WebService (.EAR) using metro and glassfish 3.1.2(b5) .
The wsdl file is published and accessible via https .
I generated the client artifact from the secured url and when I Run the client I get this error (server side):
ATTENTION: Invalid request scheme for Endpoint my_web_service. Expected https . Received http
This how I configured the secure connexion:
<glassfish-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>my_web_service</ejb-name>
<webservice-endpoint>
<port-component-name>my_web_service</port-component-name>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</webservice-endpoint>
</ejb>
</enterprise-beans>
</glassfish-ejb-jar>
If I change the implementation to a servlet endpoint (.war) everything run ok so I think that I'm missing something in the configuration.
To make this work you need to update the bundled version of grizzly in glassfish to 1.9.55 .

http-security-filter doesn't work in mule

I use Mule Server 3.3.0 CE, I generate this code:
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.3/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.3/mule-http.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.3/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/spring-security
http://www.mulesoft.org/schema/mule/spring-security/3.3/mule-spring-security.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<mule-ss:security-manager>
<mule-ss:delegate-security-provider
name="memory-dao" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="sepideh" password="16978413" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<pattern:web-service-proxy name="myService"
wsdlLocation="http://ws.acme.com:6090/wsdl/weather-forecast">
<http:inbound-endpoint address="http://localhost:8090/service">
<mule-ss:http-security-filter realm="mule-realm" />
</http:inbound-endpoint>
<http:outbound-endpoint address="http://ws.acme.com:6090/weather-forecast" />
</pattern:web-service-proxy>
I run this project and I have below exception:
ERROR 2012-11-27 14:31:25,456 [[web_service].connector.http.mule.default.receiver.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http://localhost:8090/service. Message payload is of type: String
Code : MULE_ERROR-54999
--------------------------------------------------------------------------------
Exception stack is:
1. Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http://localhost:8090/service. Message payload is of type: String (org.mule.api.security.UnauthorisedException)
org.mule.transport.http.filters.HttpBasicAuthenticationFilter:160 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/security/UnauthorisedException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.api.security.UnauthorisedException: Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http://localhost:8090/sevice. Message payload is of type: String
at org.mule.transport.http.filters.HttpBasicAuthenticationFilter.authenticateInbound(HttpBasicAuthenticationFilter.java:160)
at org.mule.security.AbstractEndpointSecurityFilter.authenticate(AbstractEndpointSecurityFilter.java:58)
at org.mule.security.AbstractAuthenticationFilter.doFilter(AbstractAuthenticationFilter.java:56)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
New wsdl address show me but I can't use this address for create web service.
All of solution link to this page, but I don't know how to change SoapUI to true value.
What should I change in my configuration?
Posting this might helps some one. People who migrating the HTTP connectors from Mule lower version to 3.6+ or 3.7( Because, I faced this error when upgrading). Please follow the link https://docs.mulesoft.com/mule-user-guide/v/3.6/configuring-the-spring-security-manager( We cannt configure mule-realm inside HTTP listener as like in version 3.3). When you try to hit it from SOAP UI, you will find the above error Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter but there was no security context on the session. It is not the problem with Mule config file.Need to change SOAPUI settings
2 ways to resolve this error:
Go to SOAPUI->File->Preference->HTTP settings-> enable the option Authenticate Preemptively
or
When setting the basic Auth In SOAPUI
Authorization->Basic -> Pre-emptive auth -> enable Authenticate Pre-emptively.
By default it will be 'Use global preference' which needs to be changed to Authenticate Pre-emptively
Thanks.
Seems related and the error you are getting is a red herring. Are you getting back a success response even if this is being logged?
http://www.mulesoft.org/jira/browse/MULE-5607