JBOSS fuse proxying the schema - xsd

I tried to create router with JBoss Fuse/Camel and deployed in successfully.
<camelContext id="blueprintContext"
trace="false"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="httpBridge">
<from uri="jetty:http://mysystem:8282/CreateAccountService?matchOnUriPrefix=true"/>
<to uri="jetty:http://mysystem:8080/service/services/CreateAccountService?bridgeEndpoint=true&throwExceptionOnFailure=false"/>
</route>
</camelContext>
Able to access the service using proxy.
I have used xsd for data types in wsdl.
<wsdl:types>
<xsd:schema xmlns:fault="http://www.sample.project.com.au/common/message/FaultMessage/v1" xmlns:pref="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountRequest/v1" xmlns:pref1="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountResponse/v1" xmlns:pref2="http://www.sample.project.com.au/common/message/TechnicalException/v1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.sample.project.com.au/services/account/CreateAccount/v1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sample.project.com.au/services/account/CreateAccount/v1">
<xsd:import namespace="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountRequest/v1" schemaLocation="http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountRequest.xsd"></xsd:import>
<xsd:import namespace="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountResponse/v1" schemaLocation="http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountResponse.xsd"></xsd:import>
</xsd:schema>
</wsdl:types>
http://mysystem:8282/CreateAccountService?wsdl (Proxy)
But, I can see all the xsd details in wsdl with
<xsd:import namespace="http://www.sample.project.com.au/services/account/CreateAccount/CreateAccountRequest/v1" schemaLocation="http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountRequest.xsd"></xsd:import>
which is original url of the schema.
http://mysystem:8080/service/services/CreateAccountService?xsd=CreateAccountRequest.xsd
I want to hide this details also.
But, I was able to see all the schema with actual url details.
How can I create the proxy for all the contents in the URI.
If I am not clear with my question, please let me know.

1)
You need to process the reply message (using message translator eip http://camel.apache.org/message-translator.html) before returning it to the client, so you can replace the url in the message body from the actual url, to the proxy url
For example you can use a bean with a single method that does the search/replace
public String transformTheMessage(String body) {
...
... search for the url you want to replace
}
And then define a bean in the xml file and use it in the Camel route
<route id="httpBridge">
<from uri="jetty:http://mysystem:8282/CreateAccountService?matchOnUriPrefix=true"/>
<to uri="jetty:http://mysystem:8080/service/services/CreateAccountService?bridgeEndpoint=true&throwExceptionOnFailure=false"/>
<to uri="bean:myBean"/>
</route>
2)
Or check if the request is for the WSDL and do a content based router, and return the content from a file which you have on the proxy server - and the file has the proxy urls hardcoded etc.
http://camel.apache.org/content-based-router.html
3)
Or check out this example
https://camel.apache.org/cxf-proxy-example.html

Related

Service Fabric Reverse Proxy not working

I have reverse proxy properly configured on both local and deployed cluster but Iam unable to access my owin based webAPI on reverse proxy port here is the response I get on this port
I have followed this link and am sure that its configured properly. The question is do I need to change some thing in my project or code to make it work.
Here is my service manifest for the webAPI :
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="BimWebApiPkg"
Version="1.0.9"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ServiceTypes>
<!-- This is the name of your ServiceType.
This name must match the string used in RegisterServiceType call in Program.cs. -->
<StatelessServiceType ServiceTypeName="BimWebApiType" />
</ServiceTypes>
<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="1.0.9">
<EntryPoint>
<ExeHost>
<Program>BimWebApi.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>
<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
independently-updateable and versioned set of custom configuration settings for your service. -->
<ConfigPackage Name="Config" Version="1.0.9" />
<Resources>
<Endpoints>
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="80" />
</Endpoints>
</Resources>
</ServiceManifest>
I also tried without specifying any port but that too didn't work.
Seems like the url is incorrect. It's missing the part where you should have app name and service name specified. Try this -
http://localhost:19081/YOUR_APP_NAME/BimWebApi/api/TestAPI/GetString/

spring integration http outbound adapter not resolving properties

We are using http outbound adapter to make http get request and we want to read URL from properties file as it changes from envt to envt. We also append some other path to this url using message payload but then it is giving us this error message "Caused by: java.lang.IllegalArgumentException: Map has no value for URL". All we need is read base url from properties file and generate final url with payload.
Here is our sample config looks like
<int-http:outbound-gateway request-channel="requestChannel"
url="${url}/{payload}"
http-method="GET"
expected-response-type="java.lang.String"
>
</int-http:outbound-gateway>
Actually {payload} in your URL is an URI variable and it can't be resolved automatically. See how it works:
UriComponentsBuilder.fromUriString(uri).buildAndExpand(uriVariables)
Where uriVariables is a Map for those URI variables.
So, in your case the expected configuration must be like this:
<int-http:outbound-gateway request-channel="requestChannel"
url="${url}/{payload}"
http-method="GET"
expected-response-type="java.lang.String">
<int-http:uri-variable name="payload" expression="payload"/>
</int-http:outbound-gateway>
More information you can find in the Reference Manual.

CXF Client Encryption , Decryption and Signing

I have developed the Web service client using CXF 3.0.0 .
When i am sending a WS request to the server i have to encrypt the header and body. The following is my cxf-client.xml configuration
<jaxws:client name="{http://batchtransfer.em.emm.ericsson.com}PushFromBankBindingPort" createdFromAPI="true">
<jaxws:properties>
<entry key="ws-security.callback-handler" value="com.ClientKeystorePasswordCallback"/>
<entry key="ws-security.encryption.properties" value="clientKeystore.properties"/>
<entry key="ws-security.signature.properties" value="clientKeystore.properties"/>
<entry key="ws-security.encryption.username" value="myservicekey"/>
</jaxws:properties>
</jaxws:client>
When i trying to run client i am getting an exception saying that
Caused by: org.apache.cxf.ws.policy.PolicyException: Security
configuration could not be detected. Potential cause: Make sure
jaxws:client element with name attribute value matching endpoint port
is defined as well as a ws-security.signature.properties element
within it
The following is my wsdl port definitions.
<service name="PushFromBankBindingService">
<port binding="iso:PushFromBankBinding" name="PushFromBankBindingPort">
<soap:address location="http://127.0.0.1:9001/PushFromBankBindingPortImpl"/>
</port>
</service>
And i have the clientKeystore.properties in a right place and keystore password also right.
But i don't know what is the problem. Please help

How can I specify the IisVirtualDirectoryPhysicalPath in the {Project}.SetParameters.xml file?

I've been unable to get our TFS build server to stop putting it's local build path in the {Project}.SetParameters.xml file. I'm currently trying to override it using a project parameters.xml file, but can't find the magic combination that will let me override that property. Main problem is that I don't know where that value comes from, so it's difficult to match & override it.
Current result:
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site/MyService" />
<setParameter name="IIS Web Application Pool Name" value="MyService" />
<setParameter name="IisVirtualDirectoryPhysicalPath" value="F:\Builds\59\EAS\MyService.Changeline_1.1.1.0\Sources\API Layer\API_deploy" />
</parameters>
I want that last line to be:
Of course, MSFT documentation is lacking in this regard. Here's my current parameters.xml file, that does not work. No build errors, it just doesn't overwrite that IisVirtualDirectoryPhysicalPath value.
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<parameter name="IisVirtualDirectoryPhysicalPath"
description="Physical path where files for this Web application will be deployed."
defaultValue="C:\Program Files\Blah\MyService\API"
tags="DestinationVirtualDirectory">
<parameterEntry kind="DestinationVirtualDirectory" scope=".*" match="^F:\\Builds[\w\s\\\.\-]+$" />
</parameter>
</parameters>
I couldn't get that parameters.xml to do anything.
If you create a MyService.wpp.targets file,
http://msdn.microsoft.com/en-us/library/ff398069(v=vs.110).aspx
Then you can add an entry into that file. It will set this value in the setparamters.xml (it wont however set the value inside the zip, which is a bit of a pain, cos what if the someone just imports the zip. But this is better than nothing.
C:\Program Files\Blah\MyService\API

Configuring Web Flow for use with JSF

I am trying to do Configuring Web Flow for use with JSF. from the following site
http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch13s04.html
but I am getting the following error:
Description Resource Path Location Type
The prefix "si" for attribute "si:schemaLocation" associated with an element type "beans" is not bound. flowwithjsf.xml /WebFlowWithJSFIntegration/src/main/webapp/WEB-INF/spring line 12 XML Problem
Here is my XML it looks just like the site:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xmlns:faces="http://www.springframework.org/schema/faces"
si:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
http://www.springframework.org/schema/faces
http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">
<!-- Executes flows: the central entry point into the Spring Web Flow system -->
<webflow:flow-executor id="flowExecutor">
<webflow:flow-execution-listeners>
<webflow:listener ref="facesContextListener"/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
<!-- The registry of executable flow definitions -->
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF">
<webflow:flow-location-pattern value="**/*-flow.xml" />
</webflow:flow-registry>
<!-- Configures the Spring Web Flow JSF integration -->
<faces:flow-builder-services id="flowBuilderServices" />
<!-- A listener maintain one FacesContext instance per Web Flow request. -->
<bean id="facesContextListener"
class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />
</beans>
try changing si:schemaLocation="... by xsi:schemaLocation="... I think that is why you are having this error
"To use this schema, include it in one of your infrastructure-layer beans files"
10.2 Spring docs

Resources