parameters in WSO2 API manager - url-routing

I am creating an API with URI template patient/{name} and production URL to http://localhost:8888/patient/{uri.var.name} in WSO2 APIM. Also adding this sequence
<sequence xmlns="http://ws.apache.org/ns/synapse" name="TestSequence">
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
</sequence>
The target URL is not being invoked with this. Can you please let me know what is the issue?

This error can occur due to Invalid URI provided by you, make sure you are using valid endpoint url for the Production Endpoint.

Related

405 - http verb used to access this page is not allowed iis in reactjs app

I am getting this error when my payment gateway is redirecting user to my react application. Same code works on firebase hosting and doesn't give the error. Redirection url is a POST request
I tried various solutions from Asp.NET Web API - 405 - HTTP verb used to access this page is not allowed - how to set handler mappings
removed WebDav
Assuming there is no CORS issue here.
The issue is the call back to your site is a Post request along with data. Client application's index.html hosted inside IIS is not able to understand how to handle a post request to a html page. You will have to specifically make an entry in Handler Mapping section of IIS configurations.
Inside Request Restrictions add the HTTP Methods you want it for or allow all verbs if it is a specific case.
Or you can directly put it in your web.config with what all verbs you want to allow, as in below snippet
<add name="html" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="Unspecified" requireAccess="None" />
On the Request Filtering page, switch to the "HTTP Verbs" tab - if you see that "POST" has "Allowed" set to False, this is the cause. Remove this entry or changing it to explicitly be allowed will fix the issue.

Camel CXF: Soap client timeout

I am using Camel CXF endpoint to connect to my soap server. I wanted to add timeout for my request from client. I am using continuationTimeout option for that. But it's not working. The request is timeout without waiting for the time that I've configured.
Below is my endpoint configuration.
<camel-cxf:cxfEndpoint id="tmAPIWSEndpoint" address="http://IN2NPDCEDB01:8088/webservices/services/TransportationManager"
wsdlURL="/wsdl/TransportationManager.wsdl"
endpointName="cis:TransportationManagerPort"
serviceName="cis:TransportationManagerService"
xmlns:cis="http://www.i2.com/cis"
continuationTimeout="60000">
<camel-cxf:properties>
<entry key="dataFormat" value="MESSAGE"/>
<entry key="username" value="XXX"/>
<entry key="password" value="XXX"/>
</camel-cxf:properties>
</camel-cxf:cxfEndpoint>
Your question is not very clear since there is no camel route so I cant see if you are creating a SOAP service inside Camel or you are calling a SOAP service from Camel as the client. Based on the little bit information you sent it seems you are creating a client.
According to the camel CXF documentation
continuationTimeout: This option is used to set the CXF continuation timeout which could be used in CxfConsumer by default
when the CXF server is using Jetty or Servlet transport. (Before
Camel 2.14.0, CxfConsumer just set the continuation timeout to be
0, which means the continuation suspend operation never timeout.)
Notice that this is related to CXF server settings not client settings. You are using this property but I dont think this is what you are looking for.
If you reference the Apache CXF Client Settings Documentation page you will find the following notes there:
ConnectionTimeout: Specifies the amount of time, in milliseconds, that the client will attempt to establish a connection before it
times out. The default is 30000 (30 seconds). 0 specifies that the
client will continue to attempt to open a connection indefinitely.
ReceiveTimeout: Specifies the amount of time, in milliseconds, that the client will wait for a response before it times out. The
default is 60000. 0 specifies that the client will wait indefinitely.
If you visit the CXF documentation page there is a lot examples there.
Here is how to do it programmatically:
HelloWorld hello = (HelloWorld) context.getBean("helloService");
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(hello);
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(5000);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(5000);
httpConduit.setClient(httpClientPolicy);
System.out.println(hello.getHelloWorldAsString("Everyone"));
(I am using spirng)
<bean id="helloService"
class="soap.timeout.demo.client.jaxws.HelloWorld"
factory-bean="helloServiceFactory" factory-method="create"/>
<bean id="helloServiceFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="soap.timeout.demo.client.jaxws.HelloWorld"/>
<property name="address" value="http://localhost:9999/ws/hello"/>
</bean>

Create proxy for Apache CXF Web services in wso2 ESB

I am a very beginner in ESB. So, kindly excuse me for this basic question.
Currently we have web services created with Apache CXF and Spring running. Now, we need to create proxy services for these in WSo2 ESB. Can someone please let us know how can we do this?
I created Pass Through proxy and use wsdl definition as from URL, but when i use try it option i get he endpoint reference (EPR) for the Operation not found is /services/ and the WSA Action = null.
If this EPR was previously reachable,please contact the server administrator.
Since ESB 4.6, pass-through transport is enabled by default : The message body is not build so, SOAP Body based dispatching is not supported => in this case, the error you're speaking about is thrown
One solution could be to add this parameter in your proxy conf : <parameter name="disableOperationValidation" locked="false">true</parameter>
Have a look there for other options : Using WSO2 ESB PassThrough Proxy on WebLogic (Spring) Web Service
How did you create the proxy service? If you have the wsdl of the Backend service you can use it to create the proxy service like follows.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="testProxy2" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<wsdl service="SimpleStockQuoteService"
port="SimpleStockQuoteServiceHttpSoap11Endpoint"
uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
</endpoint>
</target>
<description/>
</proxy>
The ESB gets the endpoint url from the Service name and Port defined in the WSDL. For SOAP 1.1 the WSA action will be the SOAPAction header and for SOAP 1.2 the WSA action goes with the action element of Content-Type header. For example,
Content-Type: application/soap+xml;charset=UTF-8;action="TheSoapAction"
Try to use a SOAP client like SOAPUI to test your proxy service.

Salesforce webservice call

I am trying to do the following;
From salesforce.com I call http get or post and post a json object using httpRequest system class. but I am getting following exception (it is https):
java.security.cert.CertificateException: No name matching issue mywebsite.com found
I have configured this website in the remote host already. Does anyone have some idea what could be wrong here?
Are you missing a call to req.setClientCertificateName?
I have APEX code where Salesforce calls out to a web service on my site. I protected it with client-side SSL. My website, the host, authorizes the client cert from Salesforce.com (vs traditional web SSL where the browser client authorizes the server cert). You can create a self-signed certificate in Salesforce Admin under Certificate and Key Management and then reference it with a call to req.setClientCertificateName. Here is some code from my production org:
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setHeader('Host', 'www.mywebsite.com');
req.setEndpoint('https://www.mywebsite.com/post.asp');
try {
req.setClientCertificateName('Cert_For_MyWebSite');
} catch (System.CalloutException e) {
// The cert doesn't make it to the sandbox
}
req.setHeader('Connection', 'keep-alive');
req.setHeader('content-type', 'text/plain');
req.setHeader('Content-Length', body.length().format());
req.setBody(body);
Http http = new Http();
HttpResponse res = http.send(req);
System.debug(res.toString());
System.debug('STATUS:' + res.getStatus());
System.debug('STATUS_CODE:' + res.getStatusCode());
On the server (IIS 7.5) I enabled the self-signed cert with this web.config:
<configuration>
<system.webServer>
<security>
<access sslFlags="Ssl, SslNegotiateCert, SslRequireCert" />
<authentication>
<iisClientCertificateMappingAuthentication enabled="true" oneToOneCertificateMappingsEnabled="true">
<oneToOneMappings>
<!-- production salesforce -->
<add enabled="true"
userName="salesforce"
password="[enc:AesProvider:aaa...aaa:enc]"
certificate="MIIEaaa...aaa=" />
</oneToOneMappings>
</iisClientCertificateMappingAuthentication>
</authentication>
</security>
</system.webServer>
</configuration>
In my other answer I was thinking about the Salesforce client cert because I remember having headaches sorting it out originally, but maybe the error is with your web server's cert. This might be a simple name matching issue. For example, the cert your server presented to Salesforce was issued to a.company.com but you're trying to use it at b.company.com. That produces a very similar java error message as talked about here and here. Does your browser give any errors when you try your service over SSL?
If you think Salesforce isn't verifying your web server's cert you can try some of the tricks suggested over here for a similar javax.net.ssl.SSLPeerUnverifiedException error. They even point to a list of CAs that are trusted by Salesforce.

Cross Domain Access Policy not working for silverlight hosted in IIS

My silverlight application is currently hosted in IIS and is set up to only use HTTPS.
the silverlight web project is the root of the IIS website and the webservices project is a seperate web application mapped to /Services.
I can navigate to my site by using "" and ""
but if I use the second option the site loads fine but I get an error when attempting to access any of my services.
An error occurred while trying to make
a request to URI
'https://localhost/Services/Services/Authentication.svc'.
This could be due to attempting to
access a service in a cross-domain way
without a proper cross-domain policy
in place, or a policy that is
unsuitable for SOAP services. You may
need to contact the owner of the
service to publish a cross-domain
policy file and to ensure it allows
SOAP-related HTTP headers to be sent.
This error may also be caused by using
internal types in the web service
proxy without using the
InternalsVisibleToAttribute attribute
I have Crossdomain.xml and clientaccesspolicy.xml files in the root of my Web Services application and also within the root of the Silverlight Web project.
Crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain- policy.dtd">
<cross-domain-policy>
<allow-access-from domain="https://*" secure="true" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
I'm not really sure what the problem is.
Thanks
Edit
The following is the what fiddler shows after calling the service. .
With fiddler set up to decode https IE didn't show any extra entries, but with chrome I get the following output
As the error message says, "This could be due to attempting to access a service in a cross-domain way..." Try using some tool such as Fiddler in the client to see what is the actual response from the server. That will give you more information about the issue.
As shown by fiddler your reference file for the service are having pointers to localhost:444 this usually happens when you have both projects in same solution and add the service reference.
I resolved this by right clicking on the frontEnd.Web part of my solution, going to properties and then the Web tab, instead of using an auto assign port option, I changed it to use local IIS server. This got rid of the error.

Resources