2017-03-03 63 views
0

我使用角度(而不是AngularJS)。我有期待XML數據的Web服務(SOAP)。使用XML的角度POST

我試圖搜索,但我找不到的完整示例POST請求XML

我需要在角2+樣品解釋數據格式,內容類型,處理響應 ...

任何幫助,將不勝感激。

回答

0
@Component({ 
    /* templateUrl, stylesUrls, selector, providers, etc. go here */ 
}) 
export class FooComponent { 
    someXml; 
    constructor(private _http:Http) {} 
    // Maybe postStuff() is called on a button click or something. 
    postStuff() { 
    this._http.post("http://example.com/api", { responseType:'text' }) 
     .subscribe(
     res => this.someXml = res 
    ); 
    } 
} 

現在,你如何解析XML,你用它做什麼是故事的第二章,但我們需要一些真實的例子來回答這個問題。