使用 XSL 更改 Siebel 服务的肥皂用户名令牌和肥皂消息密码

发布于 2024-11-05 23:37:47 字数 1679 浏览 2 评论 0原文

我正在尝试拦截 Web 服务调用,以使用 xsl 更改 Web 服务的用户凭据(用户名令牌和密码)。

SO 调用就像客户端 -->拦截器(更改用户凭据)+任何其他更改 -->调用原oracle ERP/Siebel Web服务。

这是通过 xsl 完成的...我尝试了各种选项,但没有成功... 非常需要这方面的帮助...搜索了很多网站但找不到正确的答案。

下面给出了 Web 服务请求的示例:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" >
    <soapenv:Header>
        <UsernameToken xmlns="http://siebel.com/webservices">Bill</UsernameToken>
    <PasswordText xmlns="http://siebel.com/webservices">Gates</PasswordText>            
         <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
    </soapenv:Header>
<soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
</soapenv:Body>
</soapenv:Envelope>

应使用 xsl 对其进行转换以提供以下输出:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" >
<soapenv:Header>
            <UsernameToken xmlns="http://siebel.com/webservices">Steve</UsernameToken>
            <PasswordText xmlns="http://siebel.com/webservices">Balmer</PasswordText>           
             <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
</soapenv:Header>
<soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
</soapenv:Body>
</soapenv:Envelope>

I am trying to intercept a web service call, to change the the user credentials of the webservice (username token and password) using xsl.

SO call is like client --> Interceptor (change the user credentials) + any other changes --> Call original oracle ERP/Siebel web service.

This is to be be done through xsl... I tried various options but it didn't work...
Badly need help on this... searched lots of sites but can't find correct answer.

A sample of web service request is given below:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" >
    <soapenv:Header>
        <UsernameToken xmlns="http://siebel.com/webservices">Bill</UsernameToken>
    <PasswordText xmlns="http://siebel.com/webservices">Gates</PasswordText>            
         <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
    </soapenv:Header>
<soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
</soapenv:Body>
</soapenv:Envelope>

This should be transformed using xsl to give following output:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://siebel.com/CustomUI" >
<soapenv:Header>
            <UsernameToken xmlns="http://siebel.com/webservices">Steve</UsernameToken>
            <PasswordText xmlns="http://siebel.com/webservices">Balmer</PasswordText>           
             <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
</soapenv:Header>
<soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
</soapenv:Body>
</soapenv:Envelope>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆夏时光 2024-11-12 23:37:47

此转换

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:x="http://siebel.com/webservices">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="x:UsernameToken/text()">Steve</xsl:template>
 <xsl:template match="x:PasswordText/text()">Ballmer</xsl:template>
</xsl:stylesheet>

应用于提供的 XML 文档时

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cus="http://siebel.com/CustomUI" >
    <soapenv:Header>
        <UsernameToken
        xmlns="http://siebel.com/webservices">Bill</UsernameToken>
        <PasswordText
        xmlns="http://siebel.com/webservices">Gates</PasswordText>
        <SessionType
        xmlns="http://siebel.com/webservices">None</SessionType>
    </soapenv:Header>
    <soapenv:Body>
        <cus:SiebelService>
            <a>testvalue1</a>
            <b>testvalue2</b>
        </cus:SiebelService>
    </soapenv:Body>
</soapenv:Envelope>

产生所需结果

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:cus="http://siebel.com/CustomUI">
   <soapenv:Header>
      <UsernameToken xmlns="http://siebel.com/webservices">Steve</UsernameToken>
      <PasswordText xmlns="http://siebel.com/webservices">Ballmer</PasswordText>
      <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
   </soapenv:Header>
   <soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
   </soapenv:Body>
</soapenv:Envelope>

说明:选择命名 wose 元素位于默认命名空间中是常见问题解答。在 xpath 和 xslt 标签中搜索“默认命名空间”。

This transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:x="http://siebel.com/webservices">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:template match="node()|@*">
  <xsl:copy>
   <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="x:UsernameToken/text()">Steve</xsl:template>
 <xsl:template match="x:PasswordText/text()">Ballmer</xsl:template>
</xsl:stylesheet>

when applied on the provided XML document:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cus="http://siebel.com/CustomUI" >
    <soapenv:Header>
        <UsernameToken
        xmlns="http://siebel.com/webservices">Bill</UsernameToken>
        <PasswordText
        xmlns="http://siebel.com/webservices">Gates</PasswordText>
        <SessionType
        xmlns="http://siebel.com/webservices">None</SessionType>
    </soapenv:Header>
    <soapenv:Body>
        <cus:SiebelService>
            <a>testvalue1</a>
            <b>testvalue2</b>
        </cus:SiebelService>
    </soapenv:Body>
</soapenv:Envelope>

produces the wanted result:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:cus="http://siebel.com/CustomUI">
   <soapenv:Header>
      <UsernameToken xmlns="http://siebel.com/webservices">Steve</UsernameToken>
      <PasswordText xmlns="http://siebel.com/webservices">Ballmer</PasswordText>
      <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
   </soapenv:Header>
   <soapenv:Body>
      <cus:SiebelService>
         <a>testvalue1</a>
         <b>testvalue2</b>
      </cus:SiebelService>
   </soapenv:Body>
</soapenv:Envelope>

Explanation: Selecting Names wose elements are in a default namespace is a FAQ. Search the xpath and xslt tags for "default namespace".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文