Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Need help with Flex3 Web Services.

Avatar

Level 2
Hi,



I used the Flex3 Builder Web Service Introspection Wizard to
generated my web service objects. I am having trouble invoking my
webservice. Mainly because Flex is calling the wrong endpoint. The
error msg I get in the flex console is as follows: [SWF]
C:\dev\projects\{ProjectName}\bin-debug\{ProjectName}Application.swf
- 1,106,208 bytes after decompression

faultCode:Server.Error.Request faultString:'HTTP request
error' faultDetail:'Error: [IOErrorEvent type="ioError"
bubbles=false cancelable=false eventPhase=2 text="Error #2032:
Stream Error. URL:
http://localhost:8080/{ProjectName}-WS/services"
URL:
http://localhost:8080/{ProjectName}-WS/services'



The error message I get on Tomcat for Spring-WS is as
follows: EndpointNotFound - No endpoint mapping found for
[SaajSoapMessage {
http://www.{ProjectName}.com/WebserviceClient}webServiceClient




The correct end point that should be called from flex is as
follows: {
http://www.{ProjectName}.com/system/schemas}Process{ProjectName}NumberRequest
as defined in my spring-ws servlet.xml file. Now I am not sure if
it is or not calling this endpoint but I do know it is calling the
{
http://www.{ProjectName}.com/WebserviceClient}webServiceClient
endpoint because that is in my error message.



It seem Flex is trying to call a seperate endpoint for each
node in my {ProjectName}Type.xsd file; when it should be calling
the root node from in my {ProjectName}Type.xsd file.



One last thing. I know my Webservice works because I have
tested it with my java spring client via JUnit using the root node
of the {ProjectName}Type.xsd; which is what is wired up in my
[ProjectName]-servlet.xml file.



See reply post to view my xml schemas, servlet.xml, and error
messages with the project name, among other information, stripped
out.



Thanks in advance!

Tonté
9 Replies

Avatar

Level 2
Below I have listed a copy of my xml schemas, servlet.xml,
and error messages with the project name, among other information,
stripped out.




[ProjectName]Type.xsd:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema"

targetNamespace="
http://www.{ProjectName}com/system/schemas"

xmlns:tns="
http://www.{ProjectName}com/system/schemas"

xmlns:wsClient="
http://www.{ProjectName}.com/WebserviceClient"

xmlns:cpln="
http://www.{ProjectName}.com/system/common-schemas"

elementFormDefault="qualified">



<xs:import namespace="
http://www.{ProjectName}.com/WebserviceClient"
schemaLocation="WebserviceClient.xsd"/>

<xs:import namespace="
http://www.{ProjectName}.com/system/common-schemas"
schemaLocation="[ProjectName]CommonTypes.xsd"/>



<xs:element name="Process[ProjectName]NumberRequest">

<xs:complexType>

<xs:sequence>

<xs:element ref="wsClient:webServiceClient" />

<xs:element ref="cpln:[ProjectName]Number" />

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Process[ProjectName]NumberResponse">

<xs:complexType>

<xs:sequence>

<xs:element ref="cpln:[ProjectName]Numbers"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:schema>

Avatar

Level 2
Below I have listed a copy of my xml schemas, servlet.xml,
and error messages with the project name, among other information,
stripped out.



WebserviceClient.xsd:

<?xml version="1.0" encoding="UTF-8"?>



<xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema"

targetNamespace="
http://www.{ProjectName}.com/WebserviceClient"

xmlns:tns="
http://www.{ProjectName}.com/WebserviceClient"

elementFormDefault="qualified">



<xs:element name="webServiceClient"
type="tns:webServiceClient" />



<xs:complexType name="webServiceClient">

<xs:sequence>

<xs:element name="id" type="tns:idType" />

<xs:element name="customerName" type="tns:nameType"/>

<xs:element name="customerUserName" type="tns:nameType"
/>

<xs:element name="custoemrPw" type="tns:pwType"/>

</xs:sequence>

</xs:complexType>



<xs:simpleType name="idType">

<xs:restriction base="xs:integer">

<xs:totalDigits value="10" />

</xs:restriction>

</xs:simpleType>



<xs:simpleType name="nameType">

<xs:restriction base="xs:string">

<xs:maxLength value="50" />

</xs:restriction>

</xs:simpleType>



<xs:simpleType name="pwType">

<xs:restriction base="xs:string">

<xs:maxLength value="15" />

</xs:restriction>

</xs:simpleType>

</xs:schema>

Avatar

Level 2
Below I have listed a copy of my xml schemas, servlet.xml,
and error messages with the project name, among other information,
stripped out.




[ProjectName]CommonType.xsd:

<xs:schema xmlns:xs="
http://www.w3.org/2001/XMLSchema"


targetNamespace="
http://www.{ProjectName}.com/system/common-schemas"

xmlns:tns="
http://www.{ProjectName}.com/system/common-schemas"

elementFormDefault="qualified">



<xs:element name="Number" type="tns:NumberType"/>

<xs:element name="[ProjectName]Number"
type="tns:[ProjectName]Number" />

<xs:element name="[ProjectName]Numbers">

<xs:complexType>

<xs:sequence>

<xs:element name="[ProjectName]Number"
type="tns:[ProjectName]Number" minOccurs="0"
maxOccurs="unbounded"/>

</xs:sequence>

</xs:complexType>

</xs:element>



<xs:complexType name="[ProjectName]Number">

<xs:sequence>

<xs:element name="number" type="tns:NumberType" />

<xs:element name="requestDate" type="xs:dateTime" />

<xs:element name="drawinType" default="Night">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="Night"/>

<xs:enumeration value="MidDay"/>

<xs:enumeration value="Day"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="type" default="MSG1">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="MSG1"/>

<xs:enumeration value="MSG2"/>

<xs:enumeration value="MSG3"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

</xs:sequence>

</xs:complexType>



<xs:simpleType name="NumberType">

<xs:restriction base="xs:integer">

<xs:totalDigits value="3" />

</xs:restriction>

</xs:simpleType>



</xs:schema>

Avatar

Level 2
Below I have listed a copy of my xml schemas, servlet.xml,
and error messages with the project name, among other information,
stripped out.




[ProjectName]-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="
http://www.springframework.org/schema/beans"

xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="
http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">





<bean id="[ProjectName]NumberRequestProcessor"


class="com.pouncilt.[ProjectName].webservices.core.models.[ProjectName]NumberRequestProcessor"
/>



<bean id="marshaller"

class="org.springframework.oxm.jaxb.Jaxb2Marshaller">

<!-- JAXB1 property name="contextPath"
value="com.pouncilt.[ProjectName].webservices.commons.models.generated"/-->



<property name="classesToBeBound">

<list>

<value>


com.pouncilt.[ProjectName].webservices.commons.models.generated.Process[ProjectName]NumberRequest

</value>

<value>


com.pouncilt.[ProjectName].webservices.commons.models.generated.Process[ProjectName]NumberResponse

</value>

</list>

</property>

</bean>



<bean id="payloadMapping"


class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">

<property name="endpointMap">

<map>

<entry

key="{
http://www.[ProjectName

value-ref="process[ProjectName]NumberRequestEndPoint" />

</map>

</property>

<property name="order" value="2" />

</bean>



<bean id="payloadMapping2"


class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">

<property name="endpointMap">

<map>

<entry

key="{
http://www.[ProjectName

value-ref="process[ProjectName]NumberRequestEndPoint" />

</map>

</property>

<property name="order" value="2" />

</bean>



<bean id="process[ProjectName]NumberRequestEndPoint"


class="com.pouncilt.[ProjectName].webservices.core.Process[ProjectName]NumberRequestMarshallingEndpoint">

<property name="[ProjectName]NumberRequestProcessor"

ref="[ProjectName]NumberRequestProcessor" />

<property name="marshaller" ref="marshaller" />

<property name="unmarshaller" ref="marshaller" />

</bean>





<bean id="endpointExceptionResolver"


class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">



<property name="exceptionMappings">

<props>

<prop


key="org.springframework.oxm.UnmarshallingFailureException">

SENDER, Invalid message received

</prop>

<prop

key="org.springframework.oxm.ValidationFailureException">

SENDER, Invalid message received

</prop>

</props>

</property>

<property name="defaultFault" value="RECEIVER, Server
error" />

</bean>



<bean id="[ProjectName]"


class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">

<property name="builder">

<bean


class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">

<property name="schema">

<value>

classpath:xml-schemas/[ProjectName]Types.xsd

</value>

</property>

<!--property name="schema"
value="[ProjectName]Types.xsd"/-->

<property name="portTypeName" value="[ProjectName]" />

<property name="locationUri" value="
http://localhost:8080/[ProjectName
/>

</bean>

</property>

</bean>



<!--bean id="[ProjectName]"


class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">

<property name="schema" ref="schema"/>

<property name="portTypeName" value="[ProjectName]" />

<property name="locationUri"

value="
http://localhost:8080/[ProjectName
/>

</bean-->



<!--bean id="schema"
class="org.springframework.xml.xsd.SimpleXsdSchema">

<property name="xsd">


<value>classpath:xml-schemas/[ProjectName]Types.xsd</value>

</property>

</bean-->

</beans>

Avatar

Level 2
Below I have listed a copy of my xml schemas, servlet.xml,
and error messages with the project name, among other information,
stripped out.




Tomcat Spring-WS error:

[ INFO] 10:31:30 MessageDispatcherServlet - FrameworkServlet
'[ProjectName]': init

ialization started

[ INFO] 10:31:30 XmlWebApplicationContext - Refreshing
org.springframework.web.c

ontext.support.XmlWebApplicationContext@8ceeea: display name
[WebApplicationCont

ext for namespace '[ProjectName]-servlet']; startup date [Sun
Oct 19 10:31:30 CDT

2008]; root of context hierarchy

[ INFO] 10:31:30 XmlBeanDefinitionReader - Loading XML bean
definitions from Ser

vletContext resource [/WEB-INF/[ProjectName]-servlet.xml]

[ INFO] 10:31:31 XmlWebApplicationContext - Bean factory for
application context


[org.springframework.web.context.support.XmlWebApplicationContext@8ceeea]:
org.

springframework.beans.factory.support.DefaultListableBeanFactory@987a33

[ INFO] 10:31:31 DefaultListableBeanFactory -
Pre-instantiating singletons in or

g.springframework.beans.factory.support.DefaultListableBeanFactory@987a33:
defin

ing beans
[[ProjectName]NumberRequestProcessor,marshaller,payloadMapping,processCh

ucksPick3NumberRequestEndPoint,endpointExceptionResolver,[ProjectName]];
root of f

actory hierarchy

[ INFO] 10:31:31 Jaxb2Marshaller - Creating JAXBContext with
classes to be bound

[class
com.pouncilt.[ProjectName].webservices.commons.models.generated.ProcessChu

cksPick3NumberRequest,class
com.pouncilt.[ProjectName].webservices.commons.

models.generated.Process[ProjectName]NumberResponse]

[ INFO] 10:31:31 SaajSoapMessageFactory - Creating SAAJ 1.3
MessageFactory with

SOAP 1.1 Protocol

[ INFO] 10:31:31 MessageDispatcherServlet - FrameworkServlet
'[ProjectName]': init

ialization completed in 906 ms

[ WARN] 10:31:31 EndpointNotFound - No endpoint mapping found
for [SaajSoapMessa

ge {
http://www.[ProjectName

Avatar

Level 2
It would seem the Fx Webservice Introspection is not
interpreting the wsdl correctly. By using TCPMonitor I was able to
capture my soap request from my java spring-ws junit test. The
correct response is as follows:



<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<ns4:ProcessChucksPick3LotteryNumberRequest

xmlns:ns2="
http://www.chuckspick3.com/WebserviceClient"

xmlns:ns3="
http://www.chuckspick3.com/lotterysystem/common-schemas"

xmlns:ns4="
http://www.chuckspick3.com/lotterysystem/schemas">

<ns2:webServiceClient>

<ns2:id>0</ns2:id>

<ns2:customerName>test</ns2:customerName>

<ns2:customerUserName>test</ns2:customerUserName>

<ns2:custoemrPw>test</ns2:custoemrPw>

</ns2:webServiceClient>

<ns3:chucksPick3LotteryNumber>

<ns3:number>345</ns3:number>

<ns3:requestDate>2008-10-29T20:32:37.171-05:00</ns3:requestDate>

<ns3:drawingType>MidDay</ns3:drawingType>

</ns3:chucksPick3LotteryNumber>

</ns4:ProcessChucksPick3LotteryNumberRequest>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>



Using the code generated from the Fx Webservice Introspection
wizard I get the following invalid soap request:



<SOAP-ENV:Envelope>

<SOAP-ENV:Body>

<tns:webServiceClient>

<tns:id>1</tns:id>

<tns:customerName>test</tns:customerName>

<tns:customerUserName>test</tns:customerUserName>

<tns:custoemrPw>test</tns:custoemrPw>

</tns:webServiceClient>

<ns0:chucksPick3LotteryNumber>

<ns0:number>234</ns0:number>

<ns0:requestDate xsi:nil="true"/>

<ns0:drawingType>Day</ns0:drawingType>

<ns0:type>Customer Provided Winning Pick 3 Lottery
Number</ns0:type>

</ns0:chucksPick3LotteryNumber>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>



I think there is a bug in the code generated from the Fx
Webservice Introspection wizard. You can down load my wsdl at
http://bugs.adobe.com/jira/secure/attachment/25971/chuckspick3.wsdl.xml.
I hope someone will respond to this post as I really want to use
flex for webservices; but have not been successful.



Thanks!

Avatar

Level 2
Hi

this topic is very good



best topic

Avatar

Level 2
I fixed my issue with my webservices. It turns out the
generated webservices did not include the root node that my
webservices was expecting. So I had to extend the generated
webservices to include the right node.