3
webservice는 아래와 같이 xml을 반환합니다. 소비하는 클라이언트는 < MyMethodResult>가 < 응답>이 될 것으로 예상합니다..asmx 응답에서 요소 이름을 변경하는 방법?
코드 :
[WebMethod]
public MyResponseObj MyMethod(MyRequestObj Request)
{
try
{
MyResponseObj response = new MyResponseObj();
response.Message = "test";
response.Status = Status.success;
return response;
}
catch(Exception ex)
{
throw;
}
}
실제 응답 :
<?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>
<MyMethodResponse xmlns="MyNameSpace">
<MyMethodResult>
<Status>success or failure</Status>
<Message>string</Message>
</MyMethodResult>
</MyMethodResponse>
</soap:Body>
</soap:Envelope>
예상 응답
<?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>
<MyMethodResponse xmlns="MyNameSpace">
**<Response>**
<Status>success or failure</Status>
<Message>string</Message>
**</Response>**
</MyMethodResponse>
</soap:Body>
</soap:Envelope>
코드를 생성하는 데 사용되는 코드는 어디에 있습니까? 그걸 제공해주세요. – mason
내 게시물을 코드로 업데이트했습니다. – gangt