简体   繁体   English

使用WSO2 ECLIPSE Developer Studio的SOAP API

[英]Consume SOAP API from WSO2 ECLIPSE Developer Studio

I need solution to consume two SOAP APIs . 我需要使用两个SOAP API的解决方案。

First i have a wsdl url which will work once certificate installed on machine i just want to ask that is there any type of configuration need to be done on developer studio while creating the flow. 首先,我有一个wsdl网址,一旦在计算机上安装了证书,该网址就可以工作,我只是想问在创建流程时是否需要在Developer Studio上进行任何类型的配置。

Second i need to make a flow in wso2 developer studio which will call a SOAP WSDL URL and gives response but the problem is that the wsdl contains security policy username-token ws-security configuration any expert tell me the flow for that. 其次,我需要在wso2开发人员工作室中进行一个流程,该流程将调用SOAP WSDL URL并给出响应,但是问题是wsdl包含安全策略用户名令牌ws-security配置,任何专家都告诉我该流程。

Both scenarios work in SOAP UI tool. 两种方案都可以在SOAP UI工具中使用。 I am new to wso2 anyone can help me in this?? 我是wso2的新手,任何人都可以在这方面帮助我?

Thanks in advance! 提前致谢!

For the first question the answer is no. 对于第一个问题,答案是否定的。 Certificate of the server should only be stored in the client side. 服务器的证书仅应存储在客户端。 When a TLS/SSL enabled URL is called, the server's certificate should be stored in the client's trust store. 调用启用了TLS / SSL的URL时,服务器的证书应存储在客户端的信任库中。 If your client is a WSO2 server, then that certificate should be imported to the client-truststore.jks of the WSO2 server. 如果您的客户端是WSO2服务器,则应将该证书导入WSO2服务器的client-truststore.jks That is deployment specific. 那是特定于部署的。 Nothing has to be done during the artifacts are developed in the Developer Studio. 在Developer Studio中开发工件期间,无需执行任何操作。

(1) There isn't anything to be done with dev studio. (1)开发工作室无法完成任何工作。 You need to import the backend's certificate to the trust store of the WSO2 server. 您需要将后端的证书导入到WSO2服务器的信任存储中。

(2) You can create a proxy service and call the secured backend. (2)您可以创建代理服务并调用受保护的后端。 Since your backend is secured by UT policy, you have to construct a username token when calling it. 由于您的后端受UT策略保护,因此您在调用时必须构造一个用户名令牌。 We can use a class mediator to construct and set a username token. 我们可以使用类调解器来构造和设置用户名令牌。

More details can be found at : http://xacmlinfo.org/2014/03/25/how-to-esb-invoking-username-token-secured-backend-service/ 可以在以下位置找到更多详细信息: http : //xacmlinfo.org/2014/03/25/how-to-esb-invoking-username-token-secured-backend-service/

Following is the simplified version of the class mediator. 以下是类调解器的简化版本。

public class UTTokenBuilder extends AbstractMediator{
    @Override
    public boolean mediate(MessageContext messageContext) {
        try {
            org.apache.axis2.context.MessageContext context = ((Axis2MessageContext) messageContext)
                    .getAxis2MessageContext();
            context.getOptions().setUserName("admin");
            context.getOptions().setPassword("admin");
            return true;
        } catch (SynapseException e) {
            throw e;
        } catch (Exception e) {
            throw new SynapseException("Error while building UT Token");
        }
    }
}

And following is the sample proxy to call the secured backend. 接下来是调用安全后端的示例代理。

<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="sec2"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <class name="org.soasecurity.wssecurity.ut.mediator.UTTokenBuilder"/>
         <call>
            <endpoint>
               <address uri="https://localhost:8243/services/secTestProxy">
                  <enableSec policy="conf:/UTPolicy.xml"/>
               </address>
            </endpoint>
         </call>
         <respond/>
      </inSequence>
   </target>
   <description/>
</proxy>

Please note I've used an address endpoint for simplicity. 请注意,为简单起见,我使用了一个地址端点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM