0
私はSOAP APIから生成されたクラスを持っています。SOAPリクエストの正しいヘッダを設定する
それはこの形式で送信要求の発送:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<Login>
<username>Ayo.K</username>
<password>password</password>
</Login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
をしかし、どのようなAPIが期待することは次のとおりです。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:adm="http://example.org/test_Service">
<soapenv:Header/>
<soapenv:Body>
<adm:Login>
<adm:username>Ayo.K</adm:username>
<adm:password>password</adm:password>
</adm:Login>
</soapenv:Body>
</soapenv:Envelope>
マイログインクラス:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(
name = "",
propOrder = {"username", "password"}
)
@XmlRootElement(
name = "Login",
)
public class Login {
protected String username;
protected String password;
public Login() {
}
public String getUsername() {
return this.username;
}
public void setUsername(String value) {
this.username = value;
}
public String getPassword() {
return this.password;
}
public void setPassword(String value) {
this.password = value;
}
}
私が追加した場合namespace = "http://example.org/test_Service"
〜@XmlRootElement
Login
クラスIの場合:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns3:Login xmlns:ns3="http://example.org/test_Service">
<username>Ayo.K</username>
<password>password</password>
</ns3:Login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
適切な名前空間を適切な形式で設定するにはどうすればよいですか?
ありがとうございます!