2014-10-06 2 views
1

ive가 UsernameToken 인증 (폴란드어 설명 및 설명서 : http://www.poczta-polska.pl/webservices/)을 사용하여 WS의 "String witaj (String name)"테스트 절차를 호출하려고했습니다.Android ksoap2 UsernameToken 인증 보안 처리가 실패했습니다.

private final String NAMESPACE = "http://sledzenie.pocztapolska.pl/"; 
    private final String URL = "https://tt.poczta-polska.pl/Sledzenie/services/Sledzenie?wsdl"; 
    private final String SOAP_ACTION = "http://sledzenie.pocztapolska.pl/witaj"; 
    private final String METHOD_NAME = "witaj"; 

    @Override 
    protected Void doInBackground(Void... params) { 
     SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
     PropertyInfo name = new PropertyInfo(); 
     name.setNamespace(NAMESPACE); 
     name.setName("imie"); 
     name.setValue("ciumciurumcia"); 
     name.setType(String.class); 
     request.addProperty(name); 
     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
     envelope.dotNet = true; 
//-------------------------------------------------------------------------------------------- 
     Element headers[] = new Element[1]; 
     headers[0]= new Element().createElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security"); 
     headers[0].setAttribute(envelope.env, "mustUnderstand", "1"); 
     Element security=headers[0]; 

     Element to = new Element().createElement(security.getNamespace(), "UsernameToken"); 
     to.setAttribute("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Id", "UsernameToken-2"); 

     Element action1 = new Element().createElement(security.getNamespace(), "Username"); 
     action1.addChild(Node.TEXT, "sledzeniepp"); 
     to.addChild(Node.ELEMENT,action1); 

     Element action2 = new Element().createElement(security.getNamespace(), "Password"); 
     action2.setAttribute(null, "Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile-1.0#PasswordText"); 
     action2.addChild(Node.TEXT, "PPSA"); 
     to.addChild(Node.ELEMENT,action2); 

     headers[0].addChild(Node.ELEMENT, to); 
     envelope.headerOut = headers; 
//-------------------------------------------------------------------------------------------- 
     envelope.setOutputSoapObject(request); 
     HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); 

     try { 
      androidHttpTransport.debug = true; 
      androidHttpTransport.call(SOAP_ACTION, envelope); 
... 

예 비누 봉투 문서에 설명 :

<soapenv:Envelope xmlns:sled="http://sledzenie.pocztapolska.pl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
<soapenv:Header> 
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
     <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
      <wsse:Username>sledzeniepp</wsse:Username> 
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile-1.0#PasswordText">PPSA</wsse:Password> 
     </wsse:UsernameToken> 
    </wsse:Security> 
</soapenv:Header> 
<soapenv:Body> 
    <sled:witaj> 
     <sled:imie>Jan</sled:imie> 
    </sled:witaj> 
</soapenv:Body> 

evelope 내 코드에 의해 생성 : 필자 난스 + 등재 등으로 버전을 시도

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"> 
<v:Header> 
    <n0:Security v:mustUnderstand="1" xmlns:n0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
     <n0:UsernameToken n1:Id="UsernameToken-2" xmlns:n1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
      <n0:Username>sledzeniepp</n0:Username> 
      <n0:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-tokenprofile-1.0#PasswordText">PPSA</n0:Password> 
     </n0:UsernameToken> 
    </n0:Security> 
</v:Header> 
<v:Body> 
    <n2:witaj id="o0" c:root="1" xmlns:n2="http://sledzenie.pocztapolska.pl/"> 
     <n2:imie i:type="d:string">ciumciurumcia</n2:imie> 
    </n2:witaj> 
</v:Body> 
. 하고 대답에 allways입니다 :

... <faultcode>soapenv:Server</faultcode> 
    <faultstring>WSDoAllReceiver: security processing failed</faultstring> 
    <detail /> 

나는 용의자가 봉투 태그 네임 스페이스 http://sledzenie.pocztapolska.pl/의 부족이라고 생각합니다. 그러나 나는 그것을 거기에 넣을 수 없다. 모든 설교를 환영합니다.

답변