Expand my Community achievements bar.

posting complex object by web service call

Avatar

Level 1
I have following issues with calling web service with complex
object :



Issue 1: Complex object is getting posted as null

I used class WebService provided by flex and proxy-config.xml
configuration file provided by blazeds to bypass security error
which is reaching webservice on web-qa posting Payment object as
null to server webservice method insertPayment( Payment pay).

Forum says it is bug in flex 3 and needs hotfix for flex 3
which is available for licensed copy of flex builder.



I have made web service request as follows:



1.

Service Declaration:

private var advicews:WebService;





2.

Code inside init() called on creationComplete:

advicews = new WebService();

advicews.destination = "ws-advices";

advicews.port = "AWebServiceSOAP11port_http1";

advicews.service = "AWebService";

advicews.endpointURI = "
http://web-A:8080/axis12/services1/AWebService1";


advicews.useProxy = true;



advicews.loadWSDL();

advicews.addEventListener(FaultEvent.FAULT, handleFault2 );

advicews.addEventListener(ResultEvent.RESULT, handleWSResult
);







handleFault2 definition:

public function handleFault2( fault:FaultEvent ):void

{

Alert.show( "fault message: " + fault.fault.message );

}





handleWSResult definition:

public function handleWSResult( event:ResultEvent ):void

{

Alert.show( "got result " + event.result.toString() );

}





3.

web service call on submit:

postAdvice( advicews );





4.

postAdvice method definition:



private function postAdvice( service:AbstractService ):void

{



var pay : Payment = new Payment();



var uid : UserId_type3 = new UserId_type3();

uid.userId_type2 = "t1.t1";

pay.userId = uid;



service.insertPayment(pay);



}





5.

proxy-config.xml entry for specifying the destination:



<destination id="ws-advices">

<properties>

<wsdl>
http://webA:8080/axis12/services2/AWebService?wsdl</wsdl>


<soap>*</soap>

</properties>

<adapter ref="soap-proxy"/>

</destination>





Issue 2: Security exception for cross domain web service
request



To resolve the null object posting issue mentioned above I
used the stubs generated with flex builder 3 and commented out
lines of wrapper = true and qname as mentioned in the flex forum in
the BaseAWebService proxy class generated by flex builder 3 as we
discussed.

But getting the security exception which is not resolved even
after placing crossdomain.xml policy file in ROOT.war in web
service server.



If anybody knows the solutions kindly let me know.



Anjali



0 Replies