2010-03-31 3 views
6

WSIT/Metro를 사용하여 간단한 웹 서비스를 만듭니다. 클라이언트는 간단한 사용자 이름/passowrd 인증 방식으로 연결을 시도 할 때 서버에 다음과 같은 오류를 받고 있어요 :WSIT/Metro가 보안 SOAP 헤더를 이해하지 못합니다.

2010.03.31. 19:10:33 com.sun.xml.ws.protocol.soap.MUTube getMisUnderstoodHeaders 
INFO: Element not understood={http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security 

내가 WSIT는 보안 블록을 이해하도록하는 방법을 모른다.

내가 클라이언트에서 얻을 요청 :

<?xml version="1.0" encoding="http://www.w3.org/2003/05/soap-envelope" standalone="no"?> 
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> 
    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"> 
     <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
      soapenv:mustUnderstand="true"> 
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
       wsu:Id="UsernameToken-1"> 
       <wsse:Username>admin</wsse:Username> 
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password> 
      </wsse:UsernameToken> 
     </wsse:Security> 
     <wsa:To>http://localhost:11122/services/TopJtapiRemoteMethods</wsa:To> 
     <wsa:MessageID>urn:uuid:D5C576F83D74F761311270055433217</wsa:MessageID> 
     <wsa:Action>urn:hasCallPolling</wsa:Action> 
    </soapenv:Header> 
    <soapenv:Body /> 
</soapenv:Envelope> 

서버의 WSDL :

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions 
    targetNamespace="http://soapserver.topjtapi.cti.topdesk.com" 
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
    xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" 
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
    xmlns:ns="http://soapserver.topjtapi.cti.topdesk.com" 
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/"> 
    <wsp:Policy wsu:Id="PasswordAuthPolicy"> 
     <wsp:All> 
      <sp:SupportingTokens> 
       <wsp:Policy> 
        <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> 
         <wsp:Policy> 
          <sp:WssUsernameToken10 /> 
         </wsp:Policy> 
        </sp:UsernameToken> 
       </wsp:Policy> 
      </sp:SupportingTokens> 
     </wsp:All> 
    </wsp:Policy> 

    <wsdl:types> 
     <!-- ... --> 
    </wsdl:types> 
    <wsdl:message name="incomingCallRequest"> 
     <!-- ... --> 
    </wsdl:message> 
    <wsdl:portType name="TopJtapiRemoteMethodsPortType"> 
     <!-- ... --> 
    </wsdl:portType> 
    <wsdl:binding name="TopJtapiRemoteMethodsSoap12Binding" type="ns:TopJtapiRemoteMethodsPortType"> 
     <wsp:PolicyReference URI="#PasswordAuthPolicy"/> 
     <wsoap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
     <wsdl:operation name="hasCallPolling"> 
      <!-- ... --> 
     </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="TopJtapiRemoteMethods"> 
     <wsdl:port name="TopJtapiRemoteMethodsHttpSoap12Endpoint" binding="ns:TopJtapiRemoteMethodsSoap12Binding"> 
     </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

내 코드, 서버 설정 :

import java.io.InputStream; 
import java.util.Collections; 

import javax.jws.WebService; 
import javax.xml.transform.Source; 
import javax.xml.transform.stream.StreamSource; 
import javax.xml.ws.Endpoint; 
import javax.xml.ws.Holder; 

import com.topdesk.cti.topjtapi.soapserver2.HasCallPollingResponse; 
import com.topdesk.cti.topjtapi.soapserver2.TopJtapiRemoteMethodsPortType; 

public class EndpointTester { 

    @WebService(endpointInterface = "com.topdesk.cti.topjtapi.soapserver2.TopJtapiRemoteMethodsPortType") 
    private static final class MockImplementation implements TopJtapiRemoteMethodsPortType { 
     @Override 
     public HasCallPollingResponse hasCallPolling() { 
      return null; 
     } 
    } 

    /** 
    * @see javax.xml.ws.soap.SOAPBinding#SOAP12HTTP_BINDING 
    * @see https://jax-ws.dev.java.net/2.1.7/docs/soap12.html 
    */ 
    private static final String SOAP12_BINDING_ID = "http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/"; 

    public static void main(String[] args) throws Exception { 
     Endpoint endpoint = Endpoint.create(SOAP12_BINDING_ID, new MockImplementation()); 
     InputStream wsdlStream = EndpointTester.class.getResourceAsStream("/topjtapi-webapp/wsdl/TopJtapiRemoteMethods.wsdl"); 
     endpoint.setMetadata(Collections.<Source> singletonList(new StreamSource(wsdlStream, "http://soapserver.topjtapi.cti.topdesk.com"))); 
     endpoint.publish("http://localhost/services/TopJtapiRemoteMethods"); 

     System.in.read(); 
    } 
} 

답변

0

내가 확실하지 오전 오류,하지만 난 서버가이 네임 스페이스에 대해 모른다는 가정합니다 : http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd.

고객에 대해 작성하지 않았습니다. 지하철도 생각합니다. - 같은 버전입니까? - wsimport를 사용하여 만들었습니까?

새 클라이언트를 만들지 않으려면 일부 IDE 마법사를 사용하여 클라이언트를 만들고 보안을 구성하십시오. 이것은 인간의 실수라면 작동해야합니다.

1

방금 ​​같은 문제가 있었는데, mi 프로젝트를 METRO 2.0으로 업데이트하여 해결했습니다. Netbeans에서 프로젝트 속성 -> 라이브러리 가져 오기 -> MEtro 2.0을 선택합니다.

glassfish에서는 명령 줄을 사용하여 동일한 라이브러리를 업데이트합니다.

관련 문제