PDA

View Full Version : SOAP issues with ComplexType?


kathryn
11-07-2004, 06:52 PM
I'm attempting to write a small Laszlo client for a webservice (using Apache Axis) that searches through metadata of my photographs.

The web-based application is here:
http://www.photospace.org/kathryn

The wsdl file is here:
http://www.photospace.org/kathryn/services/Photospace?wsdl

I've successfully used this with Flash 7's SOAP implementation and Macromedia Flex, but with Laszlo I'm getting some sort of SAXException and I think it might be choking on the complex data types.

My LZX:


<canvas debug="true" height="400">
<simplelayout axis="y" spacing="5"/>
<text>Search Photospace:</text>
<edittext id="query" width="200">icelandtour</edittext>
<button text="submit" onclick="canvas.photospace.searchCall.invoke(); debug.write('invoking search');" />

<debug x="15" y="100" width="415" height="200" />

<soap name="photospace" wsdl="http://www.photospace.org/kathryn/services/Photospace?wsdl">

<method event="onload">
Debug.write('photospace soap service loaded');
Debug.write('proxy:');
Debug.inspect(this.proxy);
Debug.write('----------------');
Debug.write('photospace proto:');
Debug.inspect(photospace.proto)
Debug.write('----------------');
Debug.write('SearchResult proto:');
Debug.inspect(photospace.proto.SearchResult)
Debug.write('SearchResult members are:');
Debug.inspect(photospace.proto.SearchResult.member s)
</method>

<method event="onerror" args="error">
debug.write('error:', error);
</method>


<remotecall name="searchCall" funcname="Search">
<param value="${query.getText()}" />
<param value="1"/>
<param value="0"/>
<param value="10"/>
</remotecall>
</soap>
</canvas>


First, the debugging of the SOAP client gives me:

photospace soap service loaded
proxy:
«object#0| {}» {
search: «function| [type Function]»
get: «function| [type Function]»
browse: «function| [type Function]»
}
----------------
photospace proto:
----------------
SearchResult proto:
photospace.lzx:21: reference to undefined property 'SearchResult'
SearchResult members are:
photospace.lzx:23: reference to undefined property 'SearchResult'
photospace.lzx:23: undefined object does not have a property 'members'
photospace.lzx:23: reference to undefined property 'members'
----------------


So it's not able to inspect the service's proto at all.

Then, when I hit search, I get an error:
"org.xml.sax.SAXException: Deserializing parameter 'searchReturn': could not find deserializer for type {urn:Photospace}SearchResult. When I dug up the log file from lps-2.2\WEB-INF\lps\work\logs\lps.log, I see an exception beginning with:

05 Nov 2004 01:03:21 (127.0.0.1 366) ERROR soap.SchemaParser - skipping a complexType: only support single <restriction> in <complexContent> element
java.lang.Exception: only support single <restriction> in <complexContent> element
at com.laszlosystems.remote.soap.SchemaParser.checkCo mplexContent(SchemaParser.java:140)
at com.laszlosystems.remote.soap.SchemaParser.getComp lexType(SchemaParser.java:115)


We've played around with simpler examples and can get an Axis service to return a simple string, or even arrays of strings or simple objects. But we've been unable to get Laszlo to handle the return of "typed" responses, even though the examples, such as Google, returns typed responses:
http://api.google.com/GoogleSearch.wsdl

One difference we see is that Google has <ComplexType><all> while Axis is using <ComplexType><sequence>

Any ideas on what could be going on? This seems to work in every other web service client we've tried, so we're a bit stuck and I'm new to Laszlo and especially debugging issues on it.

pablo
11-08-2004, 10:39 AM
Hi Kathryn,

The SOAP implementation has WSDL parsing problems. Known issues are:

1. <sequence> tags are not parsed
2. assumes that the target namespace defined in the WSDL definition is the target namespace of the schema.

Both of these items will be addressed in a future release.

Cheers,
pablo

micduffy
02-14-2005, 06:43 PM
I have encountered this issue in version 2.2.1 and have tried to see whether it is fixed in LPS 3.0b1.

Is it true that I cannot use complex types with the current impl of SOAP in LPS 3.0b1 ?

Could you let me know if this is going to be fixed anytime soon ?

Thanks in advance,

Michael

elaguer
02-16-2005, 07:10 AM
I'm having the same problem also, is there any work around to transform the .wsdl generated by Axis to something that Laszlo likes.

I noticed when I turn on Axis debugging on the lps I get a bunch of exceptions errors. Have a look below.

16 Feb 2005 10:57:41 (127.0.0.1 4) ERROR soap.SchemaParser - skipping a complexType: only support single <restriction> in <complexContent> element
java.lang.Exception: only support single <restriction> in <complexContent> element

pablo
02-16-2005, 09:19 AM
Hi Michael and elaguer,

This (and other SOAP bugs) are being worked on and should be available by the final 3.0 release.

pablo

micduffy
02-16-2005, 03:00 PM
Thanks Pablo.

In light of this, I will be writing a compatibility layer.

FYI I am writing a WSRP portal interface so that portlets can be displayed with Laszlo.

Thanks for your expediant response - it must be hard retrofitting a soap interface onto older versions of the SWF file format.

pablo
02-16-2005, 03:35 PM
It's interesting work, but certainly not trivial. :P

Thanks for your patience!

pablo

micduffy
03-27-2005, 03:49 AM
With the release of LPS 3.0 B2, I was keen to try out complexTypes with SOAP.

However, I am encountering some errors - particularly with the error

"SAXException: Content is not allowed in prolog."

Question, are complexTypes now supported in LPS 3.0 B2 or am I chasing my tail here ?

pablo
03-27-2005, 05:32 AM
Hi Michael,

I just replied on the laszlo-user mailing list. I'm reposting my reply here.

Are you getting that error when getting the SOAP object or when you invoke a SOAP method? If the latter, could you add

<logger name="httpclient.wire" additivity="false">
<priority value="debug" />
<appender-ref ref="lps" />
</logger>

in your lps.xml file, right below the <logger name="org.openlaszlo" additivity="false"> node, restart your server, and look at your lps.log file. You should see lines with "httpclient.wire" that will display the raw SOAP request and response.

If you're SOAP service is public, would it be possible to send me a WSDL (or an URL to the WSDL) so I could test against it?

pablo

micduffy
03-28-2005, 12:15 AM
Thanks Pablo,

BTW, Pablo was able to get this working for me by converting my test program to use document literal (as was required by the WSDL).

I am very thankful for this since I was stuck on this same problem for a while.

I am now speeding ahead with my development.

If anyone is interested in getting complexType working with SOAP, feel free to contact me and I will share my experiences.

claytongulick
10-17-2005, 12:32 PM
Do you happen to rememeber how you resolved the complex type issue in laszlo SOAP? I'm having the same troubles.

Thanks!

micduffy
10-17-2005, 03:02 PM
I upgraded to 3.02.

Let us know if u still having probs

claytongulick
10-18-2005, 06:39 AM
Yes, I'm using 3.0.2 as well, but I'm trying the RPC approach - I'll rewrite using document literal and see how that works.

My complex objects are quite complex, and nest down to 4 or 5 levels, also some of the objects use inheritance, which the WSDL represents using extension base. Its rare that I can find a SOAP technology outside of VS.Net that is able to talk to those services RPC style. Axis will do it with Java natively, but ColdFusion pukes (which uses Axis), as well as the Flash IDE.


Thanks,
-Clay

micduffy
10-18-2005, 06:42 AM
try this out and see how u go

-------- snip -----------

<canvas proxied="true" debug="true" height="100%" width="100%">
<debug x="10" y="190" width="510" height="200" />
<node id="wsrpVariables">
<attribute name="registrationHandle" />
</node>
<dataset name="dsRegister" />
<dataset name="dsInitCookie" />
<dataset name="dsPortletDescription" />
<dataset name="dsGetServiceDescription" />

<soap name="liferayWSRPRegistrationService"
wsdl="http://localhost/openlaszlo-3.0.2-servlet/RequestForwarder?requestString=localhost:81/c/wsrp/WSRPRegistrationService" >
<method event="onload">
Debug.write('Liferay WSRP Registration Service Loaded');
</method>

<method event="onerror" args="error">
debug.write('error:', error);
</method>

<method name="handler" args="response">
Debug.write('Liferay WSRP Registration Service response');
</method>
<remotecall name="register" funcname="register"
dataobject="dsRegister">
<param>
<method name="getValue">
<![CDATA[
return '<register xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'
+ '<consumerName>myLaszloConsumerName</consumerName>'
+ '<consumerAgent>myAgent</consumerAgent>'
+ '<methodGetSupported>true</methodGetSupported>'
+ '<consumerModes xsi:nil="true" />'
+ '<consumerWindowStates xsi:nil="true" />'
+ '<customUserProfileData xsi:nil="true" />'
+ '<registrationProperties xsi:nil="true" />'
+ '<extensions xsi:nil="true" />'
+ '</register>';
]]>
</method>
</param>

<method event="ondata" args="ret">
<![CDATA[
var dp = new LzDataPointer();
wsrpVariables.setAttribute("registrationHandle", dp.xpathQuery("dsRegister:/item[1]/*/registrationHandle/text()"));
Debug.write(wsrpVariables.getAttribute("registrationHandle"));
Debug.write('Liferay WSRP Registration Service response');
]]>
</method>
</remotecall>

</soap>

<soap name="liferayServiceDescriptionService"
wsdl="http://localhost/openlaszlo-3.0.2-servlet/RequestForwarder?requestString=localhost:81/c/wsrp/WSRPServiceDescriptionService">
<method event="onload">
Debug.write('Liferay WSRPServiceDescriptionService Loaded');
</method>

<method event="onerror" args="error">
debug.write('error:', error);
</method>
<method name="handler" args="response">
Debug.write('Got response:', response);
</method>

<remotecall name="getServiceDescription"
funcname="getServiceDescription"
dataobject="dsGetServiceDescription">
<param>
<method name="getValue">
<![CDATA[
return '<getServiceDescription xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'
+ '<registrationContext><registrationHandle>'+ wsrpVariables.getAttribute("registrationHandle") +'</registrationHandle></registrationContext>'
+ '</getServiceDescription>';
]]>
</method>
</param>

<method event="ondata" args="ret">
<![CDATA[
Debug.inspect(dsGetServiceDescription);
]]>
</method>
</remotecall>

<method event="ondata" args="value">
debug.write('result:\n', value);
</method>
</soap>


<soap name="liferayWSRPBaseService"
wsdl="http://localhost/openlaszlo-3.0.2-servlet/RequestForwarder?requestString=localhost:81/c/wsrp/WSRPBaseService">
<method event="onload">
Debug.write('Liferay WSRPBaseService Loaded');
</method>
<method event="onerror" args="error">
debug.write('error:', error);
</method>
<method name="handler" args="response">
Debug.write('Got response:', response);
</method>

<remotecall name="getMarkup" funcname="getMarkup"
dataobject="dsGetMarkup">
<param>
<method name="getValue">
<![CDATA[
return '<getMarkup xmlns="urn:oasis:names:tc:wsrp:v1:types">'
+'<registrationContext><registrationHandle>'+ wsrpVariables.getAttribute("registrationHandle") +'</registrationHandle></registrationContext>'
+'<portletContext>'
+'<portletHandle>58</portletHandle>'
+'</portletContext>'
+'<runtimeContext>'
+'<userAuthentication>wsrp:none</userAuthentication>'
+'<portletInstanceKey>58</portletInstanceKey>'
+'<namespacePrefix>_58_</namespacePrefix>'
+'</runtimeContext>'
+'<userContext>'
+'<userContextKey></userContextKey>'
+'<profile>'
+'<name>'
+'<prefix></prefix>'
+'<given>Michael</given>'
+'<family>Duffy</family>'
+'<middle></middle>'
+'<suffix></suffix>'
+'<nickname></nickname>'
+'</name>'
+'</profile>'
+'</userContext>'
+'<markupParams>'
+'<secureClientCommunication>false</secureClientCommunication>'
+'<locales>en</locales>'
+'<mimeTypes>text/html</mimeTypes>'
+'<mode>wsrp:view</mode>'
+'<windowState>wsrp:normal</windowState>'
+'<clientData>'
+'<userAgent>Liferay WSRP Agent</userAgent>'
+'</clientData>'
+'<markupCharacterSets>UTF-8</markupCharacterSets>'
+'<validNewModes>wsrp:view</validNewModes>'
+'<validNewModes>wsrp:help</validNewModes>'
+'<validNewModes>wsrp:edit</validNewModes>'
+'<validNewWindowStates>wsrp:normal</validNewWindowStates>'
+'<validNewWindowStates>wsrp:maximized</validNewWindowStates>'
+'<validNewWindowStates>wsrp:minimized</validNewWindowStates>'
+'</markupParams>'
+'</getMarkup>';
]]>
</method>
</param>

<method event="ondata" args="ret">
<![CDATA[
Debug.write("Got markup");
]]>
</method>
</remotecall>

<remotecall name="initCookie" funcname="initCookie"
dataobject="dsInitCookie">
<param>
<method name="getValue">
<![CDATA[
return '<initCookie xmlns="urn:oasis:names:tc:wsrp:v1:types">'
+ '<registrationContext><registrationHandle>'+ wsrpVariables.getAttribute("registrationHandle") +'</registrationHandle></registrationContext>'
+ '</initCookie>';
]]>
</method>
</param>

<method event="ondata" args="ret">
<![CDATA[
Debug.write("initialized cookie");
]]>
</method>
</remotecall>

<method event="ondata" args="value">
debug.write('result:\n', value);
</method>
</soap>


<view width="50%" height="25%">
<view layout="axis: y">
<button text="register"
onclick="Debug.write('invoking register...'); liferayWSRPRegistrationService.register.invoke();" />
<button text="getServiceDescription"
onclick="Debug.write('invoking getServiceDescription...'); liferayServiceDescriptionService.getServiceDescrip tion.invoke();" />
<button text="initCookie"
onclick="Debug.write('invoking initCookie...'); liferayWSRPBaseService.initCookie.invoke();" />
<button text="getMarkup"
onclick="Debug.write('invoking getMarkup...'); liferayWSRPBaseService.getMarkup.invoke();" />
</view>
</view>
</canvas>



-------- snip -----------

micduffy
10-18-2005, 06:43 AM
sorry, just to clarify, thats an example of document literal style that returns complex types (from a portal based WSRP Producer