wso2 esb xslt transformation - wso2-esb

I want to do xslt transformation in wso2 esb using xslt mediator I wrote a xslt and tried it in a browser it worked fine but I am not able to call my xslt in xslt mediator in wso2 esb

A: I'm always using a local-entry to reference my XSLT
<?xml version="1.0" encoding="UTF-8"?>
<localEntry xmlns="http://ws.apache.org/ns/synapse" key="myXSLTlocalEntry" src="file:repository/resources/my.xslt"/>
B: The XSLT file is under following path %WSO2_HOME%/repository/resources
C: And then I call the XSLT mediator inside of a sequence with this command:
<xslt key="myXSLTlocalEntry"/>
More documentation about the XSLT Mediator can be found on the WSO2 ESB Documentation Site:
D: The XSLT must of course also map the Soap envelope and body (which is also passed to the XSLT). Then body element then contains your effective data:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ds="ws.wso2.org/dataservice">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="soapenv:Envelope|soapenv:Body">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="ds:Entries">
<!-- DO YOUR TRANFORMATION HERE -->
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="*|text()|#*">
<xsl:copy>
<xsl:apply-templates select="*|text()|#*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

WSO2 ESB uses AXIS2 as its underlying SOAP engine..Here you are trying to eliminate soap tags, which will be present in the message lifecycle within axis2 scope. If you need to get only the message body, try to write a custom class mediator to get access for the synapse messagecontext and use following code snippet, which will return the child element of the soapbody.
messageContext.getEnvelope().getBody().getFirstChildWithName(**)

Related

Remove Server response header IIS10 from Factory configuration

I am using Outsystems tool to develop the web sites. Trying to remove server header IIS10.0 from Factory configuration. I went through the various document but I couldn't get the right solution for this.
<xsl:template match="/configuration/system.webServer/httpProtocol/customHeaders">
<xsl:copy>
<remove name="Server"/>
</xsl:copy>
</xsl:template>
Also tried
<xsl:template match="/configuration/system.webServer/security/requestFiltering">
<xsl:copy>
<add name="removeServerHeader" value="true"/>
</xsl:copy>
</xsl:template>
none of them are working, please suggest how to remove the Server header from Factory configuration.

Is it entering same SAML session after POST request is made?

There is a URL in which a SAML request is hidden. While making request, SAML authentication takes place. I would like to know if I will make the POST request to the hidden SAML URL with the same credentials as provided before. Will this session be the same as the one in which I have made the previous request.
PS: The machine, IPs and all are constant while making the requests.
Just like you open multiple tabs to access Google Docs, you would get multiple independent SAML sessions.
Each one would have different session ID and different Authentication Context.
For example, below are the two SAML responses with the same AWS IdP-init SSO SAML authentication flow.
<?xml
version="1.0"
encoding="UTF-8"
standalone="no"?>
<saml2p:Response
xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
Destination="https://signin.aws.amazon.com/saml"
ID="_c5b2e49b9abcb559d5784487a2a4b419"
IssueInstant="2019-03-04T00:27:36.738Z"
Version="2.0">
<saml2:Issuer
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">https://accounts.google.com/o/saml2?
idpid=<idp_id>
</saml2:Issuer>
<saml2p:Status>
<saml2p:StatusCode
Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</saml2p:Status>
<saml2:Assertion
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_1ad7cff1e3c1000a8f112a1a43f35457"
IssueInstant="2019-03-04T00:27:36.738Z"
Version="2.0">
<saml2:Issuer>https://accounts.google.com/o/saml2?
idpid=<idp_id>
</saml2:Issuer>
<?xml
version="1.0"
encoding="UTF-8"
standalone="no"?>
<saml2p:Response
xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
Destination="https://signin.aws.amazon.com/saml"
ID="_1a68f45a31b8abfde9850907cd65c25b"
IssueInstant="2019-03-04T00:28:27.362Z"
Version="2.0">
<saml2:Issuer
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">https://accounts.google.com/o/saml2?
idpid=<idp_id>
</saml2:Issuer>
<saml2p:Status>
<saml2p:StatusCode
Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</saml2p:Status>
<saml2:Assertion
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_f0b42fcf11de6279ffb1f890d50b57b2"
IssueInstant="2019-03-04T00:28:27.362Z"
Version="2.0">
<saml2:Issuer>https://accounts.google.com/o/saml2?
idpid=<idp_id>
</saml2:Issuer>
As you can see the SAML Response ID is different between the two.

war file deployment through weblogic

While deploying war file using weblogic-10.3.6 I am getting the exceptions like
* The error is weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
problem: cvc-enumeration-valid: string value '3.0' is not a valid enumeration value for web-app-versionType in namespace http://java.sun.com/xml/ns/javaee:*
Can anyone tell me what is the problem ?
Normally this problem indicates there is an issue with your weblogic/WSDL header information. In this case:
Weblogic 10.3.6. does not support servlet spec 3
Upgrade to 12c or choose a different version of the spec in your code/WSDL/etc
Specifically switch from something like:
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
to:
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

IDEA seems incognisant of the Servlet API 3.0 xml schema, nevertheless my web-app deploys ok?

I am able to deploy my web-application from IDEA without problems using annotation-based url-mappings, so why does IDEA nevertheless highlight the tag as a violation of the schema-definition here?
(using IDEA 12.1.4, Tomcat 7)
IDEA is validating your XML according to the schema and it is correctly saying that Element metadata-complete is not allowed here.
If you look at the schema web-app_3.0.xsd you'll see that it imports web-commmon_3.0.xsd. And this web-common schema has defined metadata-complete to be part of the web-common-attributes.
<xsd:attributeGroup name="web-common-attributes">
<xsd:attribute name="version"
type="javaee:web-app-versionType"
use="required"/>
<xsd:attribute name="id"
type="xsd:ID"/>
<xsd:attribute name="metadata-complete"
type="xsd:boolean">
...
In summary this means that metadata-complete is an attribute to web-app element.
Change your xml to this instead:
<?xml version=1.0 encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3.0.xsd"
version="3.0"
metadata-complete="false">
<display-name>Hello World</display-name>
</web-app>

SharePoint search service returns SERVER_ERROR (SQLException)

I have a simple WCF webservice client that sends a request to Microsoft Search Server (included with SharePoint 2007) on /more/_vti_bin/search.asmx
The request is sent
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Query xmlns="urn:Microsoft.Search">
<queryXml><QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000"> <Query> <Context> <QueryText language="fr-FR" type="STRING">foo bar</QueryText></Context> </Query> </QueryPacket> </queryXml>
</Query></s:Body></s:Envelope>
But the response shows a SQLException error
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<QueryResponse xmlns="urn:Microsoft.Search">
<QueryResult><ResponsePacket xmlns="urn:Microsoft.Search.Response"><Response domain=""><Status>ERROR_SERVER</Status><DebugErrorMessage>System.Data.SqlClient.SqlException</DebugErrorMessage></Response></ResponsePacket></QueryResult>
</QueryResponse></soap:Body></soap:Envelope>
It states there's been a sql exception, coulld you check on your sql machine if any errors occurred?
there is a problem with your request. test your search service using this tool
After some further analysis, I have understood that the problem lies in the fact that the Soap query does not start with an XML declaration.
<?xml version="1.0">
This is perfectly possible and respectful of standards but SharePoint doesn't like that.
The question becomes: How to force the WCF client to starts with an XML declaration.