How to parse SOAP response using FLEX - web-services

My Flex application properly call a web service but it does not populate the drop down box.
Based on my researches the problem is with the namespaces, but still not sure how to solve it.
Once I run the application the drop down box is empty.
My java code
package com.Services;
import com.classes.*;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebResult;
#WebService (name="Hellos",
targetNamespace="http://localhost:8081/Mywebservice2/services/Hellos")
public class Hellos {
#WebMethod
public #WebResult (name="customers",partName="customers") Customer[] mycustomers()
{
System.out.println("Retriving customers....");
Customer[] cus = new Customer[2];
cus[0] = new Customer("Jack", 28);
cus[1] = new Customer("Ben", 29);
return cus;
}
}
The network monitor feature of the flex application shows the response is as following
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Thu, 10 Jan 2013 04:23:55 GMT
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<mycustomersResponse xmlns="http://Services.com">
<mycustomersReturn>
<age>28</age>
<name>Jack</name>
</mycustomersReturn>
<mycustomersReturn>
<age>29</age>
<name>Ben</name>
</mycustomersReturn>
</mycustomersResponse>
</soapenv:Body>
</soapenv:Envelope>
my flex code is as following
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
protected function
dropDownList2_creationCompleteHandler(event:FlexEvent):void
{
mycustomersResult2.token = hellos.mycustomers();
}
]]>
</fx:Script>
<fx:Declarations>
<hellos:Hellos id="hellos" fault="Alert.show(event.fault.faultString + '\n'
+ event.fault.faultDetail)"
showBusyCursor="true"/>
<s:CallResponder id="mycustomersResult2"/>
</fx:Declarations>
<s:FormItem label="Label">
<s:DropDownList id="dropDownList2"
creationComplete="dropDownList2_creationCompleteHandler(event)"
labelField="age">
<s:AsyncListView list="{mycustomersResult2.lastResult}"/>
</s:DropDownList>
</s:FormItem>
When I change
<s:AsyncListView list="{mycustomersResult2.lastResult}"/>
to
<s:AsyncListView list="
{mycustomersResult2.lastResult.mycustomersResponse.mycustomersReturn}"/>
it gives the following error
Error: Unknown Property: 'mycustomersResponse'.
at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:870]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:338]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/updateParent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:239]
at mx.binding::Watcher/updateChildren()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\Watcher.as:138]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:347]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/eventHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:375]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::CallResponder/set lastResult()
at mx.rpc::CallResponder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\CallResponder.as:120]
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:239]
at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:207]
at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:244]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]
at mx.rpc::Responder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
at DirectHTTPMessageResponder/completeHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:451]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

It seems like problem with namespace for response xml format:
<mycustomersResponse xmlns="http://Services.com">
Just write anywhere in you code :
namespace ns = "http://Services.com";
use namespace ns;
I have written demo with given xml:
var xml:XML = <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<mycustomersResponse xmlns="http://Services.com">
<mycustomersReturn>
<age>28</age>
<name>Jack</name>
</mycustomersReturn>
<mycustomersReturn>
<age>29</age>
<name>Ben</name>
</mycustomersReturn>
</mycustomersResponse>
</soapenv:Body>
</soapenv:Envelope>
namespace ns = "http://Services.com";
use namespace ns;
namespace ns_soapenv = "http://schemas.xmlsoap.org/soap/envelope/";
use namespace ns_soapenv;
trace(xml.Body.mycustomersResponse.mycustomersReturn.length()); //output 2
It is parsed good. Hope it would helpful.

You don't have to parse it, the WebService class does it for you.
<s:WebService result=" soapResultHandler(event) ">
<!-- do stuff here -->
</s:WebService>
<fx:Script>
<![CDATA[
private function soapResultHandler( e:ResultEvent ):void {
//do stuff to e.result in here
}
]]>
</fx:Script>
The ResultEvent.result object is the XML automatically parsed into a single dynamic Object. You can easily loop through that to get whatever details you need. It is worth noting that if a single level of the XML document has multiple instances of the same tag name, there will be an ArrayCollection (not Array, mind) rather than a series of those objects.
See the ResultEvent#result LiveDocs

Related

Getting vCards from iCloud using PHP

Searched thru serverfault.com, stackoverflow.com, apple.stackexchange.com, googled and still not getting far. Need someone to help.
I'm trying to get all vCards from iCloud accounts.
I'm starting from the plugin from Roundcube/CardDav.
From the articles such as:
stackoverflow.com/questions/24202551/manipulate-groups-in-icloud-with-carddav-protocol
sabre.io/dav/building-a-carddav-client/
sabre.io/dav/clients/osx-addressbook/
stackoverflow.com/questions/15111887/how-to-import-icloud-contacts-in-php#
tools.ietf.org/html/rfc6352#section-8.7.1
I managed to get the Principal, the Principal's address. But the last step of getting the card returns ContentLength of 0.
Here is what I do:
- use icloud email as username
- use icloud password
To get the Principal, using "https : / / contacts.icloud.com/" as URL, PROPFIND, DEPTH 0:
<?xml version="1.0" encoding="UTF-8"?>
<d:propfind xmlns:d="DAV:">
<d:prop>
<d:current-user-principal/>
</d:prop>
</d:propfind>
Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<multistatus xmlns="DAV:">
<response>
<href>/</href>
<propstat>
<prop>
<current-user-principal>
<href>/1331115018/principal/</href>
</current-user-principal>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
Next, here is what I do to get the home, using "https : / /contacts.icloud.com/1331115018/principal/", PROPFIND, DEPTH 0:
<?xml version="1.0" encoding="UTF-8"?>
<d:propfind xmlns:d="DAV:" xmlns:card="urn:ietf:params:xml:ns:carddav">
<d:prop>
<card:addressbook-home-set/>
</d:prop>
</d:propfind>
Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<multistatus xmlns="DAV:">
<response>
<href>/1331115018/principal/</href>
<propstat>
<prop>
<addressbook-home-set xmlns="urn:ietf:params:xml:ns:carddav">
<href xmlns="DAV:">https://p44-contacts.icloud.com:443/1331115018/carddavhome/</href>
</addressbook-home-set>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
Finally, here is what I do to try to get all the vCards, using https : / / p44-contacts.icloud.com:443/1331115018/carddavhome/, REPORT, DEPTH 1:
<?xml version="1.0" encoding="utf-8" ?>
<C:addressbook-multiget xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<D:getetag/>
<C:address-data>
<C:prop name="UID"/>
<C:prop name="EMAIL"/>
<C:prop name="FN"/>
</C:address-data>
</D:prop>
</C:addressbook-multiget>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<multistatus xmlns="DAV:" xmlns:CD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
</multistatus>
or
<?xml version="1.0" encoding="utf-8" ?>
<C:addressbook-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<D:getetag/>
<C:address-data>
<C:prop name="UID"/>
<C:prop name="EMAIL"/>
<C:prop name="FN"/>
</C:address-data>
</D:prop>
</C:addressbook-query>
Response:
<?xml version="1.0" encoding="UTF-8"?>
<multistatus xmlns="DAV:" xmlns:CD="urn:ietf:params:xml:ns:carddav" xmlns:CS="http://calendarserver.org/ns/">
<response>
<href>/1331115018/carddavhome/</href>
<propstat>
<prop> <getetag>"C=0#U=9123588c-8038-439c-a547-19c866d1ed06"</getetag>
<address-data xmlns="urn:ietf:params:xml:ns:carddav">
</address-data>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
</multistatus>
or
<?xml version="1.0" encoding="utf-8" ?>
<C:addressbook-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:carddav">
<D:prop>
<D:getetag/>
<C:address-data>
<C:prop name="UID"/>
<C:prop name="EMAIL"/>
<C:prop name="FN"/>
</C:address-data>
</D:prop>
<C:prop-filter name="EMAIL">
<C:text-match collation="i;unicode-casemap" match-type="equals">me</C:text-match>
</C:prop-filter>
</C:filter>
</C:addressbook-query>
Response:
"Didn't understand the report"
What do I have to do?
The CardDAV home (your https://p44-contacts.icloud.com:443/1331115018/carddavhome/) contains the CardDAV collections (aka the 'address books'), not the vCards (which contain contacts and contact groups). You need to take one more hop.
You can list the addressbook collections in the home using a regular PROPFIND Depth 1 and then query those for the contacts with the report you specify. Like so:
PROPFIND /1331115018/carddavhome/ HTTP/1.1
Depth: 1
Host: p44-contacts.icloud.com:443
Authorization: ...
Content-Type: text/xml; charset=utf-8
Content-Length: ...
<propfind xmlns="DAV:">
<prop>
<displayname />
<resourcetype />
</prop>
</propfind>
This returns you the list of all sub-collections in the CardDAV home collection.
The collections which have an addressbook resourcetype are CardDAV addressbook collections and can be queried using an addressbook-query or addressbook-multiget report, using a sync-report if that is supported (iCloud does) or again using a simple PROPFIND. Depends on what you want.
Given an address book collection URL a 'real' client would usually use a sync-report to grab the URLs of all changed objects if the server supports that, or just grab the URLs, Content-Type and ETags of all contained vCards using a PROPFIND as a fallback. For example:
PROPFIND /1331115018/carddavhome/contacts/ HTTP/1.1
Depth: 1
Host: p44-contacts.icloud.com:443
Authorization: ...
Content-Type: text/xml; charset=utf-8
Content-Length: ...
<propfind xmlns="DAV:">
<prop>
<getetag />
<getcontenttype />
</prop>
</propfind>
This gives you the URLs of all objects in the address book collection. Which you can then retrieve using simple GETs or a multiget REPORT.
BTW: In your addressbook-multiget REPORT you do not list any vCard URLs, hence the result set will always be empty ... You can read about multiget in RFC 6352.
Note: In iCloud there is usually just one addressbook collection in the home, but in other servers it is quite common to have multiple. Also in some servers the CalDAV and CardDAV homes are the same collection (i.e. remember to actually check the resourcetype of the sub-collections in the respective home collections).
This is a great introduction on CardDAV: Building a CardDAV client.
Or this one on YouTube: FOSDEM 2009 CalDAV.
<card:addressbook-multiget xmlns:d="DAV:" xmlns:card="urn:ietf:params:xml:ns:carddav">
<d:prop>
<d:getetag />
<card:address-data />
</d:prop>
<d:href>/1331115018/carddavhome/card/vcard_UUID.vcf</d:href>
</card:addressbook-multiget>
Let try this in the REPORT Request.
Getting your credentials: https://github.com/muhlba91/icloud/blob/master/groovy_java/gui-2.1.0.zip! Keep in mind: https://support.apple.com/en-us/HT204397
Getting your vCards: https://github.com/andig/carddav2fb - just use the download command: php carddav2fb download yourdownload.vcf

How can I resolve "unexpected encoding style" using Savon Gem with Ruby on Rails

I am getting the following error when accessing a WSDL SOAP server:
{:error=>true, :message=>"Savon::SOAPFault: (env:Client) JAXRPCTIE01: caught exception while handling request: unexpected encoding style: expected=http://schemas.xmlsoap.org/soap/encoding/, actual="}
I went to soapclient.com to figure out what it's looking for.
Here is the error message I'm receiving.
Here is the code I'm using to connect to the SOAP client:
my_hash_of_stuff = {
zipcode: d_zip,
country: country
}
wsdl = 'http://my.yrc.com/dynamic/national/WebServices/YRCZipFinder_V1.wsdl'
client = Savon.client(wsdl: wsdl,
logger: Rails.logger,
log_level: :debug,
log: true,
pretty_print_xml: true,
env_namespace: :'soap-env',
strip_namespaces: true
)
response = client.call(:lookup_zip, message: my_hash_of_stuff)
print response.to_hash
Here's a copy of my log output so you can see what's happening.
This appears to be what the SOAP request should look like according to soapclient.com (if i'm understanding it correctly).
This is what I am sending.
I've been fighting with it all day and I'm sure it's probably a combination of my ignorance and something simple that i'm missing. Hopefully you guys might be able to help?
EDIT 05/25/2016:
So, looking at this again today, here's the log showing the request that savon is making:
HTTPI GET request to my.yrc.com (net_http)
SOAP request: http://my.yrc.com/dynamic/national/webservice/YRCZipFinder_V1
SOAPAction: "http://my.yrc.com/national/WebServices/YRCZipFinder_V1.wsdl/lookupCity", Content-Type: text/xml;charset=UTF-8, Content-Length: 417
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://my.yrc.com/national/WebServices/YRCZipFinder_V1.wsdl" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<tns:lookupCity>
<zipCode>84101</zipCode>
<country>USA</country>
</tns:lookupCity>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here's what a correct one looks like. I got this from the existing php app and tested it in Postman to verify that it works:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://my.yrc.com/national/WebServices/YRCZipFinder_V1.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://my.yrc.com/national/WebServices/YRCZipFinderMessages_V1.xsd" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:lookupCity>
<lookupCityRequest xsi:type="ns2:YRCLookupCityRequest">
<zipCode xsi:type="xsd:string">84101</zipCode>
<country xsi:type="ns2:CountryCode">USA</country>
</lookupCityRequest>
</ns1:lookupCity>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
UPDATE:
After some more hacking, I have my request looking like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://my.yrc.com/national/WebServices/YRCZipFinder_V1.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://my.yrc.com/national/WebServices/YRCZipFinderMessages_V1.xsd" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<tns:lookupCity lookupCityRequest="ns2:YRCLookupCityRequest">
<zipCode>84101</zipCode>
<country>USA</country>
</tns:lookupCity>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I need to get lookupCityRequest to move inside lookupCity instead of being an attribute of lookupCity, however. Testing it in Postman, that appears to be the only stumbling block left to hurdle.
You can use the special :attribute!symbol to assign additional attributes. That's a functionality from Nokogiri which Savon uses to build XML.
require 'savon'
my_hash_of_stuff =
{ zipcode: "99103",
country: 'US',
attributes!: { :country => { 'xsi:type' => 'ns2:YRCLookupCityRequest'},
:zipcode => { 'xsi:type' => 'ns2:YRCLookupCityRequest' }}
}
wsdl = 'http://my.yrc.com/dynamic/national/WebServices/YRCZipFinder_V1.wsdl'
client = Savon.client(wsdl: wsdl,
# logger: Rails.logger,
log_level: :debug,
log: true,
pretty_print_xml: true,
env_namespace: :'soap-env',
strip_namespaces: true
)
response = client.call(:lookup_zip,
message: my_hash_of_stuff)
print response.to_hash
If nothing works and you're desperate enough then you can still create your very own XML and use xml: instead of message:.

Trying to retrieve TFS workitems using ClientService.asmx

I am trying to retrieve TFS workitems using ClientService.asmx using JavaScript and I am able to access the webservice, however when using the SOAP it gives me following error "TF51612: The query does not contain any groups or expressions.
Parameter name: queryXml"
Below is the code that I am using to access the Workitems:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<RequestHeader xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<Id></Id>
</RequestHeader>
</soap:Header>
<soap:Body>
<QueryWorkitems xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<psQuery>
<queryXml>
<Wiql>SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State] FROM WorkItems WHERE [System.TeamProject] = #project AND [System.WorkItemType] <> '' AND [System.State] <> '' ORDER BY [System.Id] </Wiql>
</queryXml>
</psQuery>
</QueryWorkitems>
</soap:Body>
</soap:Envelope>
Please let me know what am I doing wrong.
Thanks
Your header SOAP must contais informations about your credential, because your query header's is empty so you are not authenticated
Add this with Soap Extension in your Web service, register in config file
After much pain I figured out how to do a proper request to this service. Here is my full request. Forgive me for the formatiing. I am apparently too dumb to figure out how to do a proper list.
Couple of notes...
*the RequestHeader Id field has to be in the format uuid:GUID
*The psQuery element is not actually in Wiql as other web sources have hinted. (Which is you are receiving the error)
*The FieldType for numeric fields is 288
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://schemas.microsoft.com/TeamFoundation/2005/06/WorkItemTracking/ClientServices/03">
<soapenv:Header>
<ns:RequestHeader>
<!--Optional:-->
<ns:Id>uuid:262c6910-8394-11e3-baa7-0800200c9a67</ns:Id>
</ns:RequestHeader>
</soapenv:Header>
<soapenv:Body>
<ns:QueryWorkitems>
<!--Optional:-->
<ns:psQuery>
<Group GroupOperator="And">
<Expression Column="System.TeamProject" FieldType="16" Operator="equals"><String>ProjectName</String></Expression>
<Expression Column="System.AssignedTo" FieldType="16" Operator="equals"><String>Daniel West</String></Expression>
<Expression Column="System.WorkItemType" FieldType="16" Operator="equals"><String>Anomaly</String></Expression>
<Expression Column="System.State" FieldType="16" Operator="equals"><String>Validate</String></Expression>
</Group>
</ns:psQuery>
<ns:sort>
<!--Zero or more repetitions:-->
<ns:QuerySortOrderEntry>
<!--Optional:-->
<ns:ColumnName>System.AssignedTo</ns:ColumnName>
<ns:Ascending>1</ns:Ascending>
</ns:QuerySortOrderEntry>
</ns:sort>
<ns:useMaster>1</ns:useMaster>
</ns:QueryWorkitems>
</soapenv:Body>
</soapenv:Envelope>

Problems with SOAP request

I am trying to integrate Siebel CRM with SAP system via...
The problem is : the SOAP request that siebel is generating is giving me an error while if I use SOAP UI to generate the SOAP request, it is working fine. Following are the error mesages and SOAP requests generated
Error from siebel SOAP request :
CX_ST_MATCH_ELEMENT:.System expected element 'PiCopyreference'".(SBL-EAI-04308)
Unsuccessful Siebel generated SOAP Request:-
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<CustomerCreatefromdata1 xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<PiCompanydata xmlns="urn:sap-com:document:sap:soap:functions:mc-style"></PiCompanydata>
<PiCopyreference xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<Salesorg xmlns="urn:sap-com:document:sap:soap:functions:mc-style">0001</Salesorg>
<DistrChan xmlns="urn:sap-com:document:sap:soap:functions:mc-style">01</DistrChan>
<Division xmlns="urn:sap-com:document:sap:soap:functions:mc-style">01</Division>
<RefCustmr xmlns="urn:sap-com:document:sap:soap:functions:mc-style">0000000011</RefCustmr>
</PiCopyreference>
<PiOptCompanydata xmlns="urn:sap-com:document:sap:soap:functions:mc-style"></PiOptCompanydata>
<PiOptPersonaldata xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<Transpzone xmlns="urn:sap-com:document:sap:soap:functions:mc-style">0000000001</Transpzone>
</PiOptPersonaldata>
<PiPersonaldata xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<TitleP xmlns="urn:sap-com:document:sap:soap:functions:mc-style">MR</TitleP>
<Firstname xmlns="urn:sap-com:document:sap:soap:functions:mc-style">FirstN</Firstname>
<Lastname xmlns="urn:sap-com:document:sap:soap:functions:mc-style">lastN</Lastname>
<City xmlns="urn:sap-com:document:sap:soap:functions:mc-style">SomeCity</City>
<PostlCod1 xmlns="urn:sap-com:document:sap:soap:functions:mc-style">7866</PostlCod1>
<Country xmlns="urn:sap-com:document:sap:soap:functions:mc-style">AT</Country>
<LanguP xmlns="urn:sap-com:document:sap:soap:functions:mc-style">E</LanguP>
<Currency xmlns="urn:sap-com:document:sap:soap:functions:mc-style">INR</Currency>
</PiPersonaldata>
</CustomerCreatefromdata1>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Successfull SOAP UI generated request :-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
<soapenv:Header/>
<soapenv:Body>
<urn:CustomerCreatefromdata1>
<PiCompanydata/>
<PiCopyreference>
<Salesorg>0001</Salesorg>
<DistrChan>01</DistrChan>
<Division>01</Division>
<RefCustmr>0000000011</RefCustmr>
</PiCopyreference>
<PiOptCompanydata/>
<PiOptPersonaldata>
<Transpzone>0000000001</Transpzone>
</PiOptPersonaldata>
<PiPersonaldata>
<TitleP>MR</TitleP>
<Firstname>FirstN</Firstname>
<Lastname>lastN</Lastname>
<City>SomeCity</City>
<PostlCod1>7866</PostlCod1>
<Country>AT</Country>
<LanguP>E</LanguP>
<Currency>INR</Currency>
</PiPersonaldata>
</urn:CustomerCreatefromdata1>
</soapenv:Body>
</soapenv:Envelope>
Also in siebel i'm generating the SOAP request using workflows(no scripting involved).
Could be namespace issue. In the Siebel external IO, you could try inactivating all the user properties for namespace at ICField level.

Axis2 exception org.apache.axis2.AxisFault: string using stub

I'm trying to create a WS, deploy it in Tomcat, inside a webapplication and use a stub to call it.
I'm using this interface as a base for the WSDL:
package com.at.iscrizio.ws.services;
public interface SalutareService {
public String sayciao(String name);
}
and this script to generate the wsdl file, the server and deploy files and the client-side files:
set WSDL_FILE=SalutareService.wsdl
set TO_WSDL=%AXIS2_HOME%/bin/java2wsdl.bat
set TO_JAVA=%AXIS2_HOME%/bin/wsdl2java.bat
set CLASS=com.at.iscrizio.ws.services.SalutareService
set SOAP_ADDR=http://localhost:9090/Iscrizio/services/SalutareServiceEx
call %TO_WSDL% -cp build/classes -o ./wsdl -of %WSDL_FILE% -cn %CLASS% -l %SOAP_ADDR%
call %TO_JAVA% -uri wsdl/%WSDL_FILE% -S generated -o axis -ss -sd -ssi --noWSDL
call %TO_JAVA% -uri wsdl/%WSDL_FILE% -S generated -o axis
This is my WS implementation
package com.at.iscrizio.ws.services;
public class SalutareServiceEx implements SalutareServiceSkeletonInterface {
#Override
public SayciaoResponse sayciao(Sayciao sayciao) {
SayciaoResponse resp = new SayciaoResponse();
resp.set_return("Ciao");
return resp;
}
}
this is my service.xml (a little bit different from the one that the standard axis build.xml generated, just to change the ServiceClass):
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: 1.6.1 Built on : Aug 31, 2011 (12:22:40 CEST) -->
<serviceGroup>
<service name="SalutareServiceEx">
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="com.at.iscrizio.ws.services.SalutareServiceMessageReceiverInOut"/>
</messageReceivers>
<parameter name="ServiceClass">com.at.iscrizio.ws.services.SalutareServiceEx</parameter>
<parameter name="useOriginalwsdl">true</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>
<operation name="sayciao" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://services.ws.iscrizio.at.com">
<actionMapping>urn:sayciao</actionMapping>
<outputActionMapping>urn:sayciaoResponse</outputActionMapping>
</operation>
</service>
</serviceGroup>
Inside server-config.wsdd, I have:
<handler name="Trace" type="java:com.at.iscrizio.ws.handler.TraceHandler"/>
<service name="SalutareServiceEx" provider="java:RPC">
<requestFlow>
<handler type="Trace"/>
</requestFlow>
<parameter name="allowedMethods" value="sayciao"/>
<parameter name="scope" value="Request"/>
<parameter name="className" value="com.at.iscrizio.ws.services.SalutareServiceEx"/>
</service>
I'm able to see the page http://localhost:9090/Iscrizio/services/SalutareServiceEx?wsdl
We're almost at the end...With this piece of code, i'm using the stub to call the ws:
SalutareServiceStub stub = new SalutareServiceStub();
SalutareServiceStub.Sayciao param = new SalutareServiceStub.Sayciao();
param.setName("Antonio");
SalutareServiceStub.SayciaoResponse resp = stub.sayciao(param);
System.out.println(resp);
the request pass through my handler (the one defined inside the wsdd), I can see using the remote debug.
Using TCPMon, i saw my request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns1:sayciao xmlns:ns1="http://services.ws.iscrizio.at.com">
<ns1:name>Antonio</ns1:name>
</ns1:sayciao>
</soapenv:Body>
</soapenv:Envelope>
and the ws response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Sender</soapenv:Value>
<soapenv:Subcode xmlns:ns1="http://www.w3.org/2003/05/soap-rpc">
<soapenv:Value>ns1:BadArguments</soapenv:Value>
</soapenv:Subcode>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en">string</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">anto-note</ns2:hostname>
</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
This is the stack trace:
Exception in thread "main" org.apache.axis2.AxisFault: string
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.at.iscrizio.ws.services.SalutareServiceStub.sayciao(SalutareServiceStub.java:185)
at com.at.iscrizio.ws.client.TestClient.main(TestClient.java:25)
Where is the problem? Excuse me for the huge post, thanks to all
At least you know that it's the server end that had the problem. The req that soapui is generating is different from your orig req? Sounds strange but soapui is usually right. Personally I would debug the server end and try to figure out where it's going wrong eg set some exception breakpoints