2010-12-22 87 views
1

我正在嘗試編寫一個SOAP客戶端以連接到期望HTTPS和WS-Security的PeopleSoft Web服務。我正在爲客戶端使用Apache CXF。下面是我做了什麼:Apache CXF在應該使用HTTPS時恢復爲HTTP

1)增加了服務器證書的信任:「jssecacerts」,用在這裏發現了一個Java實用程序: http://blogs.sun.com/andreas/entry/no_more_unable_to_find。 [編者按:原來的網頁已經從網上掉下來了。不過,我確實發現this page,我想重申,帖子的內容。]

2)利用CXF 2.3.1的WSDL2JAVA工具,編輯腳本後設置系統屬性使用信任的WSDL創建Java客戶端類我創建了。

3)創建的客戶端代碼:

public void init(String endpoint, String peopleSoftUser, String peopleSoftPass) throws QueryException{ 

    this.peopleSoftUser = peopleSoftUser; 
    this.peopleSoftPass = peopleSoftPass; 

    loggingInterceptor = new LoggingOutInterceptor(); 
    loggingInInterceptor = new LoggingInInterceptor(); 

    //System.setProperty("javax.net.debug", "ssl"); 

    try { 
    URL url = new URL(endpoint); 
    log.debug("Using URL " + url); 

    System.setProperty("javax.net.ssl.trustStore", "/Users/micksear/jssecacerts"); 
    System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); 

    service = new QASQRYSERVICE(url);//, QASQRYSERVICE.SERVICE 
    //port = service.getPort(QASQRYSERVICE.QASQRYSERVICEPort, QASQRYSERVICEPortType.class); 
    port = service.getQASQRYSERVICEPort(); 
    conduit = (HTTPConduit) ClientProxy.getClient(port).getConduit(); 

    WSS4JOutInterceptor wss4j = new WSS4JOutInterceptor(); 
    wss4j.getProperties().put("action", "UsernameToken"); 
    wss4j.getProperties().put("passwordType", "PasswordText");//PasswordDigest 
    wss4j.getProperties().put("user", "PS"); 
    wss4j.getProperties().put("passwordCallbackRef", new CallbackHandler(){ 

    @Override 
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { 
    WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; 
    log.debug("identifier: " + pc.getIdentifier()); 

    if (pc.getIdentifier().equals("PS")) { 
     // set the password on the callback. This will later be compared to the 
     // password which was sent from the client. 
     pc.setPassword("PS"); 
    } 
    }}); 

    ClientProxy.getClient(port).getOutInterceptors().add(loggingInterceptor); 
    ClientProxy.getClient(port).getOutInterceptors().add(wss4j); 
    ClientProxy.getClient(port).getInInterceptors().add(loggingInInterceptor); 


    } catch (MalformedURLException e) { 
    log.error(e.getMessage(), e); 
    throw new QueryException(e); 
    } 
} 

    public static void main(String[] args) throws MalformedURLException, QueryException { 

    PeopleSoftQueryService qryService = new PeopleSoftQueryService(); 
    qryService.init("https://HR91DMO/PSIGW/PeopleSoftServiceListeningConnector/QAS_QRY_SERVICE.1.wsdl", "PS", "PS"); 

    try { 
    QueryResult result = qryService.executeQuery("ABSENCE_REASON_LOOKUP"); 

    for (Map<String,String> row : result.getData()){ 
    System.out.println("Row: "); 
    for (String key : row.keySet()){ 
    System.out.println(" " + key + " = " + row.get(key)); 
    } 
    } 
    } catch (SOAPFaultException e) { 
    logSoapFaultException(e, log); 
    } 


} 

    public QueryResult executeQuery(String queryName) throws QueryException { 
    QASEXEQRYSYNCREQMSGType msg = new QASEXEQRYSYNCREQMSGType(); 
    QASEXEQRYSYNCREQTypeShape msgTypeShape = new QASEXEQRYSYNCREQTypeShape(); 
    msgTypeShape.setQueryName(queryName); 
    msgTypeShape.setIsConnectedQuery("N"); 
    msgTypeShape.setOwnerType("PUBLIC"); 
    msgTypeShape.setBlockSizeKB(new BigInteger("0")); 
    msgTypeShape.setMaxRow(new BigInteger("100")); 
    msgTypeShape.setOutResultType(OutResultTypeTypeDef.XMLP); 
    msgTypeShape.setOutResultFormat(OutResultFormatTypeDef.NONFILE); 
    msg.setQASEXEQRYSYNCREQ(msgTypeShape); 

    QASGETQUERYRESULTSRESPMSGType result = port.qasEXECUTEQRYSYNCOPER(msg); 

    Map<Integer,String> columnMetadata = new HashMap<Integer,String>(); 
    QueryResult resultData = new QueryResult(); 

    Iterator<ColumnDefinition> columnIterator = result.getWebRowSet().getMetadata().getColumnDefinition().iterator(); 
    while (columnIterator.hasNext()){ 
    ColumnDefinition column = columnIterator.next(); 
    String columnName = column.getColumnName(); 
    columnMetadata.put(new Integer(column.getColumnIndex()), columnName); 
    } 

    Iterator<Object> rowIterator = result.getWebRowSet().getData().getCurrentRowAndInsertRowAndDeleteRow().iterator(); 
    while (rowIterator.hasNext()){ 
    CurrentRow row = (CurrentRow) rowIterator.next(); 
    Map<String,String> rowMap = new HashMap<String,String>(); 
    for (int i = 0 ; i < columnMetadata.size() ; i++){ 
    String value = row.getColumnValue().get(i).toString(); 
    rowMap.put(columnMetadata.get(i), value); 
    } 

    resultData.addRow(rowMap); 
    } 

    resultData.setNumRows(resultData.getData().size()); 
    return resultData; 
} 

那麼,是從HTTPS WSDL URL創建客戶端類,不包含HTTP引用。我寫的客戶端代碼不包含HTTP引用。當我運行的代碼,它似乎正確執行SSL握手,然後拋出一個異常:

2010-12-22 11:44:50,162 [main] DEBUG org.apache.ws.security.util.Loader - 

org.apache.security.juice.provider.JuiCEProviderOpenSSL 
java.lang.ClassNotFoundException: org.apache.security.juice.provider.JuiCEProviderOpenSSL 
at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:248) 
at org.apache.ws.security.util.Loader.loadClass(Loader.java:185) 
at org.apache.ws.security.WSSConfig.loadProvider(WSSConfig.java:605) 
at org.apache.ws.security.WSSConfig.addJceProvider(WSSConfig.java:662) 
at org.apache.ws.security.WSSConfig.staticInit(WSSConfig.java:306) 
at org.apache.ws.security.WSSConfig.<init>(WSSConfig.java:324) 
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:333) 
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:173) 
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:134) 
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) 
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) 
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) 
at $Proxy42.qasEXECUTEQRYSYNCOPER(Unknown Source) 
at com.succeed.peoplesoft.soap.PeopleSoftQueryService.executeQuery(PeopleSoftQueryService.java:154) 
at com.succeed.peoplesoft.soap.PeopleSoftQueryService.main(PeopleSoftQueryService.java:188) 
2010-12-22 11:44:50,164 [main] DEBUG org.apache.ws.security.WSSConfig - The provider JuiCE could not be added: org.apache.security.juice.provider.JuiCEProviderOpenSSL 
2010-12-22 11:44:50,176 [main] DEBUG org.apache.ws.security.handler.WSHandler - Performing Action: 1 
2010-12-22 11:44:50,177 [main] DEBUG com.succeed.peoplesoft.soap.PeopleSoftQueryService - identifier: PS 
2010-12-22 11:44:50,179 [main] DEBUG org.apache.ws.security.message.WSSecUsernameToken - Begin add username token... 
Dec 22, 2010 11:44:50 AM org.apache.cxf.interceptor.AbstractLoggingInterceptor log 
INFO: Outbound Message 
--------------------------- 
ID: 1 
Address: http://192.168.1.91/PSIGW/PeopleSoftServiceListeningConnector 
Encoding: UTF-8 
Content-Type: text/xml 
Headers: {SOAPAction=["QAS_EXECUTEQRYSYNC.VERSION_1"], Accept=[*/*]} 
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1"><wsse:Username>PS</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PS</wsse:Password></wsse:UsernameToken></wsse:Security></soap:Header><soap:Body><ns86:QAS_EXEQRY_SYNC_REQ_MSG xmlns:ns10="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_RECORD_DEFN_REQ_MSG.VERISON_1" xmlns:ns11="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_RECORD_DEFN_RESP_MSG.VERSION_1" xmlns:ns12="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERYSTATUS_REQ.VERSION_1" xmlns:ns13="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERYSTATUS_REQ_MSG.VERSION_1" xmlns:ns14="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERYSTATUS_RESP.VERSION_1" xmlns:ns15="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERYSTATUS_RESP_MSG.VERSION_1" xmlns:ns16="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_HIERARCHY_RECORDS_REQ_MSG.VERSION_1" xmlns:ns17="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_HIERARCHY_RECORDS_RESP_MSG.VERSION_1" xmlns:ns18="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_CANCELQUERY_REQ.VERSION_1" xmlns:ns19="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_CANCELQUERY_REQ_MSG.VERSION_1" xmlns:ns2="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLE_REQ_MSG.VERSION_1" xmlns:ns20="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_CANCELQUERY_RESP.VERSION_1" xmlns:ns21="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_CANCELQUERY_RESP_MSG.VERSION_1" xmlns:ns22="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSERROLES_REQ.VERSION_1" xmlns:ns23="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSERROLES_REQ_MSG.VERSION_1" xmlns:ns24="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSERROLES_RESP.VERSION_1" xmlns:ns25="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSERROLES_RESP_MSG.VERSION_1" xmlns:ns26="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYFIELDS_REQ.VERSION_1" xmlns:ns27="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYFIELDS_REQ_MSG.VERSION_1" xmlns:ns28="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYFIELDS_RESP.VERSION_1" xmlns:ns29="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYFIELDS_RESP_MSG.VERSION_1" xmlns:ns3="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLE_RESP.VERSION_1" xmlns:ns30="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_RELATED_RECORDS_REQ_MSG.VERSION_1" xmlns:ns31="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_RELATED_RECORDS_RESP_MSG.VERSION_1" xmlns:ns32="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSER_REQ.VERSION_1" xmlns:ns33="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSER_REQ_MSG.VERSION_1" xmlns:ns34="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSER_RESP.VERSION_1" xmlns:ns35="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTUSER_RESP_MSG.VERSION_1" xmlns:ns36="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_DETAILS_REQ_MSG.VERSION_1" xmlns:ns37="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_DETAILS_RESP_MSG.VERSION_1" xmlns:ns38="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERY_REQ.VERSION_1" xmlns:ns39="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERY_REQ_MSG.VERSION_1" xmlns:ns4="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLE_RESP_MSG.VERSION_1" xmlns:ns40="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERY_RESP.VERSION_1" xmlns:ns41="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERY_RESP_MSG.VERSION_1" xmlns:ns42="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_TREES_REQ_MSG.VERSION_1" xmlns:ns43="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_TREES_RESP_MSG.VERSION_1" xmlns:ns44="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLEUSERS_REQ.VERSION_1" xmlns:ns45="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLEUSERS_REQ_MSG.VERSION_1" xmlns:ns46="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLEUSERS_RESP.VERSION_1" xmlns:ns47="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLEUSERS_RESP_MSG.VERSION_1" xmlns:ns48="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRY_ASYNC_REQ.VERSION_1" xmlns:ns49="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRY_SYNC_REQ.VERSION_1" xmlns:ns5="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTROLE_REQ.VERSION_1" xmlns:ns50="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERYRESULTS_FILE_RESP.VERSION_1" xmlns:ns51="http://java.sun.com/xml/ns/jdbc" xmlns:ns52="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERYRESULTS_XMLP_RESP.VERSION_1" xmlns:ns53="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERYRESULTS_STATUS_RESP.VERSION_1" xmlns:ns54="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LOGIN_RESP_MSG.VERSION_1" xmlns:ns55="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_DELETE_REQ_MSG.VERSION_1" xmlns:ns56="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_DELETE_RESP_MSG.VERSION_1" xmlns:ns57="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETQUERYRESULTS_REQ.VERSION_1" xmlns:ns58="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETQUERYRESULTS_REQ_MSG.VERSION_1" xmlns:ns59="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_SAVE_REQ_MSG.VERSION_1" xmlns:ns6="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_AUTHTOKEN_REQ_MSG.VERSION_1" xmlns:ns60="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_QUERY_SAVE_RESP_MSG.VERSION_1" xmlns:ns61="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYPROMPTS_REQ.VERSION_1" xmlns:ns62="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYPROMPTS_REQ_MSG.VERSION_1" xmlns:ns63="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYPROMPTS_RESP.VERSION_1" xmlns:ns64="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LISTQUERYPROMPTS_RESP_MSG.VERSION_1" xmlns:ns65="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_RECORDS_REQ_MSG.VERSION_1" xmlns:ns66="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_RECORDS_RESP_MSG.VERSION_1" xmlns:ns67="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETXLAT_REQ.VERSION_1" xmlns:ns68="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETXLAT_REQ_MSG.VERSION_1" xmlns:ns69="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETXLAT_RESP.VERSION_1" xmlns:ns7="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_AUTHTOKEN_RESP_MSG.VERSION_1" xmlns:ns70="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETXLAT_RESP_MSG.VERSION_1" xmlns:ns71="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRY_SYNCPOLL_REQ.VERSION_1" xmlns:ns72="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRYSYNCPOLL_RESP.VERSION_1" xmlns:ns73="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRYSYNCPOLL_RESP_MSG.VERSION_1" xmlns:ns74="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETPRMPTTBLVAL_REQ.VERSION_1" xmlns:ns75="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETPRMPTTBLVAL_REQ_MSG.VERSION_1" xmlns:ns76="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETPRMPTTBLVAL_RESP.VERSION_1" xmlns:ns77="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETPRMPTTBLVAL_RESP_MSG.VERSION_1" xmlns:ns78="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_TREE_DETAILS_REQ_MSG.VERSION_1" xmlns:ns79="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_TREE_DETAILS_RESP_MSG.VERSION_1" xmlns:ns8="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_FIELD_PROPS_REQ_MSG.VERSION_1" xmlns:ns80="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_FIELDS_REQ_MSG.VERSION_1" xmlns:ns81="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_FIELDS_RESP_MSG.VERSION_1" xmlns:ns82="http://schemas.xmlsoap.org/ws/2003/03/addressing" xmlns:ns83="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRY_ASYNC_REQ_MSG.VERSION_1" xmlns:ns84="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_GETQUERYRESULTS_RESP_MSG.VERSION_1" xmlns:ns85="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_LOGIN_REQ_MSG.VERSION_1" xmlns:ns86="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRY_SYNC_REQ_MSG.VERSION_1" xmlns:ns87="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_EXEQRY_SYNCPOLL_REQ_MSG.VERSION_1" xmlns:ns9="http://xmlns.oracle.com/Enterprise/Tools/schemas/QAS_FIELD_PROPS_RESP_MSG.VERSION_1"><ns49:QAS_EXEQRY_SYNC_REQ><QueryName>ABSENCE_REASON_LOOKUP</QueryName><isConnectedQuery>N</isConnectedQuery><OwnerType>PUBLIC</OwnerType><BlockSizeKB>0</BlockSizeKB><MaxRow>100</MaxRow><OutResultType>XMLP</OutResultType><OutResultFormat>NONFILE</OutResultFormat></ns49:QAS_EXEQRY_SYNC_REQ></ns86:QAS_EXEQRY_SYNC_REQ_MSG></soap:Body></soap:Envelope> 
-------------------------------------- 
Dec 22, 2010 11:44:50 AM org.apache.cxf.interceptor.AbstractLoggingInterceptor log 
INFO: Inbound Message 
---------------------------- 
ID: 1 
Response-Code: 500 
Encoding: UTF-8 
Content-Type: text/xml; charset=UTF-8 
Headers: {content-type=[text/xml; charset=UTF-8], Date=[Wed, 22 Dec 2010 11:43:56 GMT], Content-Length=[672], X-Powered-By=[Servlet/2.5 JSP/2.1]} 
Payload: <?xml version="1.0" ?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>null</faultstring><detail><IBResponse type="error" xmlns=""><DefaultTitle>Integration Broker Response</DefaultTitle><StatusCode>20</StatusCode><MessageID>554</MessageID><DefaultMessage><![CDATA[Encryption and Digital Signed or Https required for Service Operation QAS_EXECUTEQRYSYNC_OPER. (158,554)]]></DefaultMessage><MessageParameters><Parameter><![CDATA[QAS_EXECUTEQRYSYNC_OPER]]></Parameter></MessageParameters></IBResponse></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> 
-------------------------------------- 
2010-12-22 11:44:50,759 [main] ERROR com.succeed.peoplesoft.soap.PeopleSoftQueryService - Error: <detail><IBResponse type="error" xmlns=""><DefaultTitle>Integration Broker Response</DefaultTitle><StatusCode>20</StatusCode><MessageID>554</MessageID><DefaultMessage><![CDATA[Encryption and Digital Signed or Https required for Service Operation QAS_EXECUTEQRYSYNC_OPER. (158,554)]]></DefaultMessage><MessageParameters><Parameter><![CDATA[QAS_EXECUTEQRYSYNC_OPER]]></Parameter></MessageParameters></IBResponse></detail> 
javax.xml.ws.soap.SOAPFaultException: null 
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146) 
at $Proxy42.qasEXECUTEQRYSYNCOPER(Unknown Source) 
at com.succeed.peoplesoft.soap.PeopleSoftQueryService.executeQuery(PeopleSoftQueryService.java:154) 
at com.succeed.peoplesoft.soap.PeopleSoftQueryService.main(PeopleSoftQueryService.java:188) 
Caused by: org.apache.cxf.binding.soap.SoapFault: null 
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75) 
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46) 
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35) 
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) 
at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:99) 
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69) 
at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34) 
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) 
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:755) 
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2330) 
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2192) 
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2036) 
at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47) 
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188) 
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) 
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:696) 
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) 
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) 
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) 
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) 
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) 
... 3 more 

我檢查和果汁是一座休眠Apache孵化器項目。我的類路徑中也有完整的CXF庫,所以我不確定它爲什麼要加載這個類。我懷疑,但不知道,這是什麼導致它恢復到HTTP(順便說一句,192.168.1.91是HR91DMO解決的IP地址)。

我想使用Java配置,而不是現在的Spring配置,部分原因是我想了解發生了什麼並簡化了示例,部分原因是某些配置可能在運行時,而我不想必須在每次更改時都用新的Spring配置文件重新編譯WAR。

任何人都可以闡明我做錯了什麼?

回答

1

我解決了這個問題 - 它仍然使用WSDL中的端點URL,當時我認爲我重寫了它。我這樣做:

BindingProvider provider = (BindingProvider)port; 
provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint); 

這是我從摸索出:http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html

有用於覆蓋地址列出3分不同的方式。