调用wso2管理服务SOAPUI

调用wso2管理服务SOAPUI,wso2,wso2esb,Wso2,Wso2esb,我正在从事wso2管理服务。我以http://localhost:9763/services/AuthenticationAdmin?wsdl用于AuthencticationAdmin 现在,当我点击登录操作时,使用admin,admin,127.0.0.1,返回true ESB控制台显示已登录 现在,当我点击注销操作时,我没有得到任何响应 我还注意到响应的头不包含任何会话ID 我的ESB是4.6.0 登录请求: <soapenv:Envelope xmlns:soapenv="http

我正在从事wso2管理服务。我以
http://localhost:9763/services/AuthenticationAdmin?wsdl
用于AuthencticationAdmin

现在,当我点击登录操作时,使用admin,admin,127.0.0.1,返回true

ESB控制台显示已登录

现在,当我点击注销操作时,我没有得到任何响应

我还注意到响应的头不包含任何会话ID

我的ESB是4.6.0

登录请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://authentication.services.core.carbon.wso2.org">
   <soapenv:Header/>
   <soapenv:Body>
      <aut:login>
         <!--Optional:-->
         <aut:username>admin</aut:username>
         <!--Optional:-->
         <aut:password>admin</aut:password>
         <!--Optional:-->
         <aut:remoteAddress>127.0.0.1</aut:remoteAddress>
      </aut:login>
   </soapenv:Body>
</soapenv:Envelope>
现在,我没有会话ID。你能指出我哪里出错了吗


我的情况是,我想登录到WSO2,然后点击其他一些管理服务操作。

您可以尝试使用java客户端访问服务器。有一个例子。您可以尝试此示例并转储SOAP消息,以查看与您在SOAPUI中看到的不同之处

我想知道示例
setManageSession(true)
是否在会话中发挥了一些魔力:

public static void main(String[] args) throws 
            RemoteException, AuthenticationAdminAuthenticationExceptionException {

    System.setProperty("javax.net.ssl.trustStore", 
                        SampleConstants.CLIENT_TRUST_STORE_PATH);
    System.setProperty("javax.net.ssl.trustStorePassword", 
                        SampleConstants.KEY_STORE_PASSWORD);
    System.setProperty("javax.net.ssl.trustStoreType", 
                        SampleConstants.KEY_STORE_TYPE);

    AuthenticationAdminStub stub = 
          new AuthenticationAdminStub(
                 "https://localhost:9443/services/AuthenticationAdmin");
    ServiceClient client = stub._getServiceClient();
    Options options = client.getOptions();
    options.setManageSession(true);

    Login login = new Login();
    login.setUsername("admin");
    login.setPassword("admin");
    stub.login(login);

    ServiceContext serviceContext = stub.
            _getServiceClient().getLastOperationContext().getServiceContext();
    String sessionCookie = (String) serviceContext
                               .getProperty(HTTPConstants.COOKIE_STRING);

    System.out.println(sessionCookie);      
}
上面的代码打印出类似于以下内容的内容:


JSESSIONID=844ECBED015805A24FF9DBD5F5A56C8D;路径=/;Secure=null;HttpOnly=null

在与java客户端调试了一段时间后(参见我的另一个答案),我注意到SOAPUI端点没有使用我在java客户端中使用的9443端口。见下图

SOAPUI从WSDL中获取了8243端口

当我将SOAP UI端点端口从8243更改为9443时,JSESSIONID将在响应中返回,如下所示:

HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=573D42750DE6C0A287E1582239EB5847; Path=/; Secure; HttpOnly
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 26 Jun 2013 22:14:20 GMT
Server: WSO2 Carbon Server

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:loginResponse xmlns:ns="http://authentication.services.core.carbon.wso2.org"><ns:return>true</ns:return></ns:loginResponse></soapenv:Body></soapenv:Envelope>
HTTP/1.1200正常
设置Cookie:JSESSIONID=573D42750DE6C0A287E1582239EB5847;路径=/;保护HttpOnly
内容类型:text/xml;字符集=UTF-8
传输编码:分块
日期:2013年6月26日星期三格林尼治标准时间22:14:20
服务器:WSO2碳服务器
真的

我不知道端口8243和9443之间有什么区别,也不知道为什么一个返回JSESSIONID而另一个不返回。

您使用的是什么版本的ESB?嘿,谢谢。。。它起作用了。。我得到了会话ID。。。我甚至无法注销。。。谢谢你的帮助,伙计!
public static void main(String[] args) throws 
            RemoteException, AuthenticationAdminAuthenticationExceptionException {

    System.setProperty("javax.net.ssl.trustStore", 
                        SampleConstants.CLIENT_TRUST_STORE_PATH);
    System.setProperty("javax.net.ssl.trustStorePassword", 
                        SampleConstants.KEY_STORE_PASSWORD);
    System.setProperty("javax.net.ssl.trustStoreType", 
                        SampleConstants.KEY_STORE_TYPE);

    AuthenticationAdminStub stub = 
          new AuthenticationAdminStub(
                 "https://localhost:9443/services/AuthenticationAdmin");
    ServiceClient client = stub._getServiceClient();
    Options options = client.getOptions();
    options.setManageSession(true);

    Login login = new Login();
    login.setUsername("admin");
    login.setPassword("admin");
    stub.login(login);

    ServiceContext serviceContext = stub.
            _getServiceClient().getLastOperationContext().getServiceContext();
    String sessionCookie = (String) serviceContext
                               .getProperty(HTTPConstants.COOKIE_STRING);

    System.out.println(sessionCookie);      
}
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=573D42750DE6C0A287E1582239EB5847; Path=/; Secure; HttpOnly
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 26 Jun 2013 22:14:20 GMT
Server: WSO2 Carbon Server

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:loginResponse xmlns:ns="http://authentication.services.core.carbon.wso2.org"><ns:return>true</ns:return></ns:loginResponse></soapenv:Body></soapenv:Envelope>