[
https://issues.apache.org/jira/browse/CXF-1598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600954#action_12600954
]
Alton Idowu commented on CXF-1598:
----------------------------------
DAO
-----------------------
public class TestDAO {
private static final Log logger = LogFactory.getLog(TestDAO .class);
private TestServiceClient testServiceClient;
public void setTestServiceClientProxy(TestServiceClient
testServiceClientProxy) {
this.testServiceClient = testServiceClientProxy;
}
public String executeQuery(String query) {
try {
return testServiceClient.executeQuery(query);
} catch(Throwable t) {
logger.error("Error with Test web service excuting query: "
+ query, t);
throw new RuntimeException(t);
}
}
}
CLIENT
---------------------------------------------
import javax.jws.WebService;
import org.apache.cxf.interceptor.InInterceptors;
import org.apache.cxf.interceptor.OutInterceptors;
@WebService(targetNamespace = "urn:test.ilss.sup",
serviceName = "service",
portName = "serviceHttpPort")
@InInterceptors(interceptors =
"org.apache.cxf.interceptor.LoggingInInterceptor")
@OutInterceptors(interceptors =
"org.apache.cxf.interceptor.LoggingOutInterceptor")
public interface TestServiceClient {
public String executeQuery(String query) throws Throwable;
}
FACTORY
------------------------------------
import java.net.MalformedURLException;
import java.net.URL;
import test.cfg.ConfigurationManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
public class TestClientFactoryBean extends JaxWsProxyFactoryBean {
private static final Log logger =
LogFactory.getLog(TestClientFactoryBean .class);
private static final String URL_TEMPLATE = "/vip/queryservice.ws?wsdl";
private static String SERVICE_URL;
static {
SERVICE_URL =
ConfigurationManager.ApplicationProperties.getTestUrl()
+ URL_TEMPLATE;
try {
// Just to double check it formed properly
new URL(SERVICE_URL);
} catch (MalformedURLException e) {
logger.error("Invalid URL for Test web service : " +
SERVICE_URL, e);
}
}
@Override
public void setWsdlURL(String url) {
super.setWsdlURL(SERVICE_URL);
}
}
CXF.XML
-----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--
TODO: build extension to JaxRpcPortProxyFactoryBean which
looks up the service from a db.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd">
<import resource="classpath:META-INF/cxf/cxf-all.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<bean id="cxf" class="org.apache.cxf.bus.extension.ExtensionManagerBus"/>
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
<bean id="testServiceFactory" class="test.service.TestClientFactoryBean"
lazy-init="true">
<property name="serviceClass" value="test.service.TestServiceClient"/>
<property name="wsdlURL" value="http://127.0.0.1"/>
<property name="bus" ref="cxf"/>
</bean>
<bean id="testServiceClient" class="test.service.TestServiceClient"
factory-bean="testServiceFactory" factory-method="create"
lazy-init="true"/>
<bean id="testServiceClientProxy"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource">
<bean
class="org.springframework.aop.target.LazyInitTargetSource">
<property name="targetBeanName">
<idref local="testServiceClient"/>
</property>
</bean>
</property>
<property name="proxyInterfaces"
value="test.service.TestServiceClient"/>
</bean>
</beans>
> Soap message generated via JaxWsProxyFactoryBean created client fails
> ---------------------------------------------------------------------
>
> Key: CXF-1598
> URL: https://issues.apache.org/jira/browse/CXF-1598
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.1
> Environment: Windows XP, Ubuntu 7.04, jdk 1.5.0_09, CXF 2.1
> Reporter: Alton Idowu
> Assignee: Daniel Kulp
>
> The soap messages generated through DynamicClientFactory and
> JaxWsProxyFactoryBean are different. The message generated via the
> DynamicClientFactory created client generates a soap message with qualified
> parameters that is accepted by web service provider. However, the message
> JaxWsProxyFactoryBean created client generates a soap message with
> unqualified parameters that is rejected by the web service provider. Is
> there a parameter or custom interceptor code that I can use to force the
> JaxWsProxyFactoryBean created client to qualify the parameters?
> Unfortunately, changing the web service provider is not an option as their
> change management process is very arduous.
> Soap message generated via the DynamicClientFactory client:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:executeQuery xmlns:ns1="urn:test.ilss.sup">
> <in0 xmlns="urn:test.ilss.sup">
> TEST DATA
> </in0>
> </ns1:executeQuery>
> </soap:Body>
> </soap:Envelope>
> Soap message generated via the JaxWsProxyFactoryBean client:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns2:executeQuery xmlns:ns2="urn:test.ilss.sup">
> <in0>
> TEST DATA
> </in0>
> </ns2:executeQuery>
> </soap:Body>
> </soap:Envelope>
> The web service provider sends the following message for the
> JaxWsProxyFactoryBean client:
> <?xml version='1.0' encoding='UTF-8'?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <soap:Fault>
> <faultcode>Server</faultcode>
> <faultstring>Parameter in0 does not exist!</faultstring>
> </soap:Fault>
> </soap:Body>
> </soap:Envelope>
> WSDL:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:tns="urn:test.ilss.sup"
> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="urn:test.ilss.sup">
> <wsdl:types>
> <xsd:schema targetNamespace="urn:test.ilss.sup"
> elementFormDefault="qualified" attributeFormDefault="qualified">
> <xsd:element name="executeQuery">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="in0" type="xsd:string" minOccurs="1"
> maxOccurs="1" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="executeQueryResponse">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="out" type="xsd:string" minOccurs="1"
> maxOccurs="1" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> </wsdl:types>
> <wsdl:message name="executeQueryResponse">
> <wsdl:part element="tns:executeQueryResponse" name="parameters" />
> </wsdl:message>
> <wsdl:message name="executeQueryRequest">
> <wsdl:part element="tns:executeQuery" name="parameters" />
> </wsdl:message>
> <wsdl:portType name="servicePortType">
> <wsdl:operation name="executeQuery">
> <wsdl:input message="tns:executeQueryRequest"
> name="executeQueryRequest" />
> <wsdl:output message="tns:executeQueryResponse"
> name="executeQueryResponse" />
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="serviceHttpBinding" type="tns:servicePortType">
> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> <wsdl:operation name="executeQuery">
> <wsdlsoap:operation soapAction="" />
> <wsdl:input name="executeQueryRequest">
> <wsdlsoap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="executeQueryResponse">
> <wsdlsoap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="service">
> <wsdl:port binding="tns:serviceHttpBinding" name="serviceHttpPort">
> <wsdlsoap:address location="http://****/vip/queryservice.ws" />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.