問題: この非常に単純な jax-ws Web サービス (以下を参照) を何度も再作成してデプロイしました。しかし、この単純な Web サービス アプリを動作させることができませんでした。
つまり、単純な SOAP リクエスト (以下の「サービス リクエスト」を参照) を送信すると、「wsa:MessageAddressingHeaderRequired」というエラーが表示されます。
質問: 「wsa:MessageAddressingHeaderRequired」というエラーの原因は何ですか?
以下の詳細情報...
これが実装クラスです...
package aaa.bbb.ccc;
import ccc.bbb.aaa.testws.ObjectFactory;
import ccc.bbb.aaa.testws.ResponseType;
import javax.jws.WebService;
@WebService(serviceName = "testws", portName = "testwsSOAP", endpointInterface = "ccc.bbb.aaa.testws.Testws", targetNamespace = "http://aaa.bbb.ccc/testws/", wsdlLocation = "WEB-INF/wsdl/testws.wsdl")
public class testws
{
public ccc.bbb.aaa.testws.ResponseType multiplyOperation(ccc.bbb.aaa.testws.RequestType request)
{
Integer value1 = new Integer(request.getParmValue1());
Integer value2 = new Integer(request.getParmValue2());
Integer product = value1 * value2;
ObjectFactory factory = new ObjectFactory();
ResponseType response = factory.createResponseType();
response.setValue1(value1.toString());
response.setValue2(value2.toString());
response.setProduct(product.toString());
return response;
}
}
これがWSDLです...
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://aaa.bbb.ccc/testws/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="testws"
targetNamespace="http://aaa.bbb.ccc/testws/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1="http://www.w3.org/ns/ws-policy" xmlns:fi="http://java.sun.com/xml/ns/wsit/2006/09/policy/fastinfoset/service" xmlns:tcp="http://java.sun.com/xml/ns/wsit/2006/09/policy/soaptcp/service" xmlns:wsaw="http://www.w3.org/2005/08/addressing" xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" xmlns:sunrm="http://sun.com/2006/03/rm" xmlns:net="http://schemas.microsoft.com/net/2005/02/rm/policy">
<wsdl:types>
<xsd:schema targetNamespace="http://aaa.bbb.ccc/testws/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:Q1="http://aaa.bbb.ccc/testws">
<xsd:import schemaLocation="testws.xsd"
namespace="http://aaa.bbb.ccc/testws">
</xsd:import>
<xsd:element name="multiplyOperation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="request"
type="Q1:requestType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="multiplyOperationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="response"
type="Q1:responseType" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="multiplyOperationRequest">
<wsdl:part element="tns:multiplyOperation" name="parameters" />
</wsdl:message>
<wsdl:message name="multiplyOperationResponse">
<wsdl:part element="tns:multiplyOperationResponse"
name="parameters" />
</wsdl:message>
<wsdl:portType name="testws">
<wsdl:operation name="multiplyOperation">
<wsdl:input message="tns:multiplyOperationRequest" />
<wsdl:output message="tns:multiplyOperationResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testwsSOAP" type="tns:testws">
<wsaw:UsingAddressing wsdl:required="true" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/>
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="multiplyOperation">
<soap:operation
soapAction="http://aaa.bbb.ccc/testws/multiplyOperation" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="testws">
<wsdl:port binding="tns:testwsSOAP" name="testwsSOAP">
<soap:address location="http://aaa.bbb.ccc/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
これがXSDです...
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://aaa.bbb.ccc/testws"
xmlns:tns="http://aaa.bbb.ccc/testws"
elementFormDefault="qualified">
<element name="query" type="tns:queryType"></element>
<complexType name="queryType">
<choice>
<element name="request" type="tns:requestType"></element>
<element name="response" type="tns:responseType"></element>
</choice>
</complexType>
<complexType name="requestType">
<sequence>
<element name="parmValue1" type="string"></element>
<element name="parmValue2" type="string"></element>
</sequence>
</complexType>
<complexType name="responseType">
<sequence>
<element name="value1" type="string"></element>
<element name="value2" type="string"></element>
<element name="product" type="string"></element>
</sequence>
</complexType>
</schema>
検査依頼はこちら...
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
<env:Body>
<multiplyOperation xmlns="http://aaa.bbb.ccc/testws/" xmlns:tes="http://aaa.bbb.ccc/testws">
<request xmlns="">
<tes:parmValue1>3</tes:parmValue1>
<tes:parmValue2>4</tes:parmValue2>
</request>
</multiplyOperation>
</env:Body>
</env:Envelope>
これがテスト応答です...
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<FaultDetail xmlns="http://www.w3.org/2005/08/addressing">
<ProblemHeaderQName>{http://www.w3.org/2005/08/addressing}Action</ProblemHeaderQName>
</FaultDetail>
</S:Header>
<S:Body>
<SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode xmlns:wsa="http://www.w3.org/2005/08/addressing">wsa:MessageAddressingHeaderRequired</faultcode>
<faultstring>A required header representing a Message Addressing Property is not present</faultstring>
</SOAP-ENV:Fault>
</S:Body>
</S:Envelope>
これが私が使用したMavenビルドスクリプトです...
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb.ccc</groupId>
<artifactId>testwswaronly</artifactId>
<packaging>war</packaging>
<version>1</version>
<name>testwswaronly</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-rt</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>testws.wsdl</wsdlFile>
</wsdlFiles>
<staleFile>${project.build.directory}/jaxws/stale/testws.stale</staleFile>
</configuration>
<id>wsimport-generate-testws</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<webResources>
<resource>
<directory>src</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>jax-ws-catalog.xml</include>
<include>wsdl/**</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<netbeans.hint.deploy.server>WebLogic9</netbeans.hint.deploy.server>
</properties>
</project>