1
我創建使用Apache cxf.I使用的網絡鉤捕獲數據,並找出在HTTP頭中SOAPAction的SOAP客戶端是空空的SOAPAction的Apache CXF
的SOAPAction: 「」
以下是密碼
URL wsdlurl=SOAPWebServiceTransport.class.getClassLoader().
getResource("my.wsdl");
OnlinePort service= new OnlinePortService(wsdlurl).getOnlinePortPort();
Client proxy = ClientProxy.getClient(service);
// Provides WS-Security
WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor();
wss4jOut.setProperty("action", "UsernameToken");
wss4jOut.setProperty("user", userName);
wss4jOut.setProperty("passwordType", "PasswordText");
wss4jOut.setProperty("password", password);
wss4jOut.setProperty(WSHandlerConstants.ADD_UT_ELEMENTS,
WSConstants.NONCE_LN + " " + WSConstants.CREATED_LN);
wss4jOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, ServerPasswordCallback.class.getName());
proxy.getEndpoint().getOutInterceptors().add(wss4jOut);
setConduitProperties((HTTPConduit) proxy.getConduit(),url);
在setConduitProperties我只是設置一些http屬性。 在調查這個問題,我發現周圍的工作
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("SOAPAction", Arrays.asList("myPrefix:mySoapMethod"));
proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);
但問題是,如果我有一個以上的方法,然後在HTTP報頭的把所有的方法
的SOAPAction:「myPrefix: mySoapMethod,myPrefix:mySoapMethod2「
有沒有更好的解決方案來處理這個問題?