2012-02-28 3 views
2

다음은 SOAP 서버에 대한 SOAP 1.1 요청의 샘플이지만 그 내용은 중요하지 않습니다. 비누 내용 길이

POST /_vti_bin/lists.asmx HTTP/1.1 
Host: 192.168.0.25 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/GetList" 

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
     <listName>string</listName> 
    </GetList> 
    </soap:Body> 
</soap:Envelope> 

필드 콘텐츠 길이

: 길이 필요는 실제 값으로 대체합니다. 그 가치는 무엇입니까? 어디서 볼 수 있니? 또는 요청 전에 값을 계산하는 방법은 무엇입니까?

UPD1. 은 내가 Content-Length 값이 첫 번째 <로 시작하고 여기에 몸의 마지막 문자, > 아니면 개행 문자로 끝나는 몸의 (바이트) 길이

headerPropertyObj = new HeaderProperty("Content-Length", "383"); // should be calc before 
headerList.add(headerPropertyObj); 

    transport.setUrl(URL); 
    request = new SoapObject(NAMESPACE, METHOD_NAME); 

    request.addProperty("listName", "Tasks"); 


    envelope.setOutputSoapObject(request); 

    transport.call(SOAP_ACTION, envelope, headerList); 
+0

SOAP 요청을 어떻게 작성하고 있습니까? – McDowell

+0

이 링크는 도움이 될 수도 있습니다. http://stackoverflow.com/questions/290172/calculating-soap-content-length – Xara

+0

** transport.call (SOAP_ACTION, envelope, headerList);에서 전체 쿼리를 볼 수 있습니다. ** ,하지만 난이 방법 전에 calc content-length가 필요하다. – Gorets

답변

2

나는이 문제를 해결했다. 나 자신에게 내가

 public List call(String soapAction, SoapSerializationEnvelope envelope, List headers) 
    throws IOException, XmlPullParserException { 

      if (soapAction == null) 
        soapAction = "\"\""; 

      byte[] requestData = createRequestData(envelope); 

      requestDump = debug ? new String(requestData) : null; 
      responseDump = null; 

      connection = getServiceConnection(); 

      connection.setRequestProperty("User-Agent", "kSOAP/2.0"); 
//   connection.setRequestProperty("SOAPAction", soapAction); 
//   connection.setRequestProperty("Content-Type", "text/xml"); 
      connection.setRequestProperty("Content-Type", "application/soap+xml"); 
      connection.setRequestProperty("Connection", "close"); 
      connection.setRequestProperty("Content-Length", "" + requestData.length); 

그것의 나를 위해 도움이 아래처럼 호출 방법을 다시로드 클래스

public class MyHttpTransportSE extends Transport 

을 썼다, 나는이 남을 위해 도움이되기를 바랍니다.

1

lib에는 ksoap 사용합니다.

0

혼자서 머리글을 설정하지 않고 올바른 방법으로 봉투를 만드는 것으로 충분합니다. 길이가 라이브러리 자체에 의해 계산되고 유지되도록

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
envelope.setOutputSoapObject(request); 
httpTransport.debug = true; //try debugging 

문제가 셰어 인증에 관련된 경우

http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data

는, 당신은 제대로 봉투 헤더를 추가해야합니다. Error in authentication when subscribing to a sharepoint webservice using ksoap2-android

이 도움이 될 수 : http://davidsit.wordpress.com/2010/03/03/creating-sharepoint-list-items-with-php/

+0

필자의 봉투 헤더에 이전 쿼리의 토큰을 추가해야합니다. 토큰은 셰어 포인트 서버에 대한 인증 데이터가있는 쿠키입니다. 다른 데이터는 없습니다. – Gorets

+0

수정 됨. 'maybe'도움이되었습니다. – Alfabravo

+0

인증 문제가 해결되었습니다. 인증 wsdl에서 응답을 구문 분석하고 쿠키를 수집하여 다음 쿼리에 추가했습니다. – Gorets

관련 문제