I am making an app in which I am using SOAP web service, I am receiving this data -
<?xml version="1.0" encoding="UTF-8"?>
<User xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.myurl.com/">
<code>200</code>
<profile>
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<id>1</id>
<country>Afghanistan</country>
<isd_code>93</isd_code>
<timezone>+04:30</timezone>
<visible>false</visible>
</Table>
</NewDataSet>
</profile>
</User>
And I am using GData library to read this data. I am able to read <NewDataSet> element values but don't know how to read value of <code> tag. So please suggest me to do this.
Related
I am trying to access a 3rd party web service using Apache CXF 3.1. When I call the service with the wsdl2java generated code or curl the service returns an exception indicating the message is not a valid SOAP message. See the message below.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<connectivityTest xmlns="urn:cdc:iisb:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="connectivityTest">
<echoBack>Hello IIS!</echoBack>
</connectivityTest>
</soap:Body>
</soap:Envelope>
When I remove the namespace (soap:) and call the service using curl the service works. See working message below.
<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
<Body>
<connectivityTest xmlns="urn:cdc:iisb:2011" xmlns:ns2="http://www.w3.org/2003/05/soap-envelope">
<echoBack>Hello IIS V2!</echoBack>
</connectivityTest>
</Body>
How do I remove the namespace from the Envelope and Body elements of my SOAP message before it sent? Based on searching the web it looks like I may need to create an interceptor. If some one can provide an example of an interceptor to remove the namespace from the Envelope and Body elements it would be much appreciated.
Thanks in advance!
JR
No Interceptor is required for this. You can configure the namespace in your jaxws properties.
<jaxws:properties>
<entry key="soap.env.ns.map">
<map>
<entry key="" value="http://schemas.xmlsoap.org/soap/envelope/"/>
</map>
</entry>
<entry key="disable.outputstream.optimization" value="true"/>
</jaxws:properties>
According to the Accounting API docs named lists items are soft deleted, so it is possible to reactivate them with a sparse update where Active is set to true. This is working fine for Term, Account, PaymentMethod, and Department.
However we ran into issues when trying to sparse update Class and TaxCode. Here are the request/response we got in each case:
<?xml version="1.0" encoding="UTF-8"?>
<Class xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>5000000000000020362</Id>
<Name>Consultancy (deleted)</Name>
<SyncToken>1</SyncToken>
<Active>true</Active>
</Class>
Response from request to sparse update to reactivate class:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2016-12-29T10:36:51.732-08:00">
<Fault type="ValidationFault">
<Error code="6000" element="">
<Message>A business validation error has occurred while processing your request</Message>
<Detail>Business Validation Error: You cannot modify a list element that has been deleted.</Detail>
</Error>
</Fault>
</IntuitResponse>
Request to activate a tax code
<?xml version="1.0" encoding="UTF-8"?>
<TaxCode xmlns="http://schema.intuit.com/finance/v3" sparse="true">
<Id>4</Id>
<Name>California - Inactive</Name>
<SyncToken>1</SyncToken>
<Active>true</Active>
</TaxCode>
Response from request to sparse update to reactivate tax code:
<?xml version="1.0" encoding="UTF-8"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2016-12-30T14:20:24.614-08:00">
<Fault type="ValidationFault">
<Error code="500" element="Operation">
<Message>Unsupported Operation</Message>
<Detail>Operation Update is not supported.</Detail>
</Error>
</Fault>
</IntuitResponse>
Any help would be much appreciated.
Thanks,
Fernando
I'm starting to evaluate WSO2 ESB and try to implement some simple but real life scenarios.
What I'm trying to do, in this specific case is connect to a web-service that uses a session-key in the payload to do the authentication. So there is one web-service call with user and password to get the key and then I need to put this into the payload of the second web-service call to actually retrieve data from a service.
I don't want to log in with every service call, for performance reasons, but log in once, store the key for some time and do a couple of requests.
The service I want to call is a SugarCRM web-service.
The login message would be something like this:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<user_auth xsi:type="sug:user_auth">
<user_name xsi:type="xsd:string">interface</user_name>
<password xsi:type="xsd:string">MD5HASHOFPASSWORD</password>
</user_auth>
<application_name xsd:string">dummy</application_name>
<name_value_list xsi:type="sug:name_value_list" soapenc:arrayType="sug:name_value[]"/>
</sug:login>
</soapenv:Body>
Which returns something like this:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.sugarcrm.com/sugarcrm">
<SOAP-ENV:Body>
<ns1:loginResponse xmlns:ns1="http://www.sugarcrm.com/sugarcrm">
<return xsi:type="tns:entry_value">
<id xsi:type="xsd:string">loggfi0i3j6eeugs7l0a0m2587</id>
</return>
</ns1:loginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Then I need to use the "id" field as the token for a new request.
Example, to request all the Leads (the "id" is put into the "session" field):
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sug="http://www.sugarcrm.com/sugarcrm" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<sug:get_entry_list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<session xsi:type="xsd:string">loggfi0i3j6eeugs7l0a0m2587</session>
<module_name xsi:type="xsd:string">Leads</module_name>
</sug:get_entry_list>
</soapenv:Body>
</soapenv:Envelope>
This request then returns all the Leads in the database.
Equally this is needed for accessing web-services that use OAuth2, for example the REST-API of MS Dynamics CRM, only then I need to put the token/bearer in the header.
How would I go about realizing the above scenario in WSO2 ESB? I'm sure this is pretty common, but I have not found documentation or examples for it.
Here is the sequence to get the session-id from the CRM:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="sugar_login" trace="enable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<sug:login xmlns:sug="http://www.sugarcrm.com/sugarcrm">
<sug:user_auth>
<user_name>interface</user_name>
<password>MD5HASHOFPASSWORD</password>
<version>1</version>
</sug:user_auth>
<application_name>dummy</application_name>
</sug:login>
</format>
</payloadFactory>
<header name="To" value="http://my.sugarcrm.com:9090/service/v4_1/soap.php"/>
<call>
<endpoint name="templEPTimeout" template="org.wso2.carbon.connector.sugarcrm.timeout">
<axis2ns653:parameter name="timoutDuration" value="6000" xmlns:axis2ns653="http://ws.apache.org/ns/synapse"/>
<axis2ns654:parameter name="maximumDuration" value="3000" xmlns:axis2ns654="http://ws.apache.org/ns/synapse"/>
<axis2ns655:parameter name="progressAFactor" value="2.0" xmlns:axis2ns655="http://ws.apache.org/ns/synapse"/>
<axis2ns656:parameter name="initialDuration" value="2000" xmlns:axis2ns656="http://ws.apache.org/ns/synapse"/>
</endpoint>
</call>
<!-- Remove response custom header information -->
<header action="remove" name="X-SOAP-Server" scope="transport"/>
<header action="remove" name="Cache-control" scope="transport"/>
<header action="remove" name="Vary" scope="transport"/>
<header action="remove" name="Expires" scope="transport"/>
<header action="remove" name="Set-Cookie" scope="transport"/>
<header action="remove" name="path" scope="transport"/>
<property expression="//ns1:loginResponse/return/id"
name="sugarsessionid" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
</sequence>
You can use the sugarcrm connector to connect with SugarCRM API. You can find the sugarcrm connector at WSO2 Store. Find more details in the documentation.
I'm attempting to perform a batch update of google contacts per https://developers.google.com/google-apps/contacts/v3/#batch_operations_for_contacts, but I'm getting an "Invalid entry Id/Uri" error. I'm posting the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gContact="http://schemas.google.com/contact/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" gd:etag=""RHwzfzVSLyt7I2A9XRVREk4DQQw."">
<entry gd:etag=""Q34zcDVSLit7I2A9XRVTFkkOTwE."">
<id>http://www.google.com/m8/feeds/contacts/emiliano.heyns%40iris-advies.com/base/376125d892c1b5a</id>
<batch:id>delete-cornel.straver#han.nl</batch:id>
<batch:operation type="delete"/>
</entry>
</feed>
to which I'm getting this response:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gd="http://schemas.google.com/g/2005" xmlns:gContact="http://schemas.google.com/contact/2008">
<id>https://www.google.com/m8/feeds/contacts/emiliano.heyns%40iris-advies.com/full/batch/1432240618884</id>
<updated>2015-05-21T20:36:58.884Z</updated>
<title>Batch Feed</title>
<entry>
<id>http://www.google.com/m8/feeds/contacts/emiliano.heyns%40iris-advies.com/base/376125d892c1b5a</id>
<updated>2015-05-21T20:36:58.884Z</updated>
<title>Error</title>
<content>Invalid entry Id/Uri</content>
<batch:id>delete-cornel.straver#han.nl</batch:id>
<batch:status code="400" reason="Invalid entry Id/Uri"/>
<batch:operation type="delete"/>
</entry>
</feed>
I know the etags and the ID are correct as I've gotten them by requesting the contacts feed; it's the response from that which I'm modyfying into the query above.
I'm trying to use the REST API for IIS Media Services to create a Live Publishing point programatically. For this, I'm sending a POST call to this URL:
http://127.0.0.1/services/smoothstreaming/publishingpoints.isml/settings
I've included two custom headers to the request:
Content-Type: application/atom+xml
Slug: /test.isml
And this is the body of the request:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<id>http://127.0.0.1/test.isml/settings</id>
<title>Test</title>
<updated>2012-07-12T19:13:25Z</updated>
<content type="application/xml">
<SmoothStreaming xmlns="http://schemas.microsoft.com/iis/media/2011/03/streaming/management">
<Settings>
<Title>Test</Title>
<SourceType>Push</SourceType>
<AutoStart>false</AutoStart>
<AutoRestartOnEncoderReconnect>false</AutoRestartOnEncoderReconnect>
<LookAheadChunks>2</LookAheadChunks>
<Archive enabled="false">
<Path useEventIdOnPath="false" />
</Archive>
<ClientConnections enabled="true">
<ClientManifestVersion>2.0</ClientManifestVersion>
</ClientConnections>
<ServerConnections enabled="false">
<SendEndOfStreamOnStop>false</SendEndOfStreamOnStop>
</ServerConnections>
</Settings>
</SmoothStreaming>
</content>
</entry>
IIS is giving me a 405/Bad Request error with this body:
<?xml version="1.0" encoding="UTF-8"?>
<SmoothStreaming xmlns="http://schemas.microsoft.com/iis/media/2011/03/streaming/management">
<Error>
<ErrorCode>0x80880026</ErrorCode>
<ErrorMessage>The resource contains one or more elements that contain invalid data. For information about valid resource representations, please see the documentation for the supported schemas.</ErrorMessage>
</Error>
</SmoothStreaming>
Anyone knows what I'm doing wrong here?
Ommiting the "Archive" and "ServerConnections" nodes fixed it. Not sure it there's anything wrong in them, or if they're only supposed to be included when enabled=true.