Can anyone help me see why NSXMLParser is not causing these methods
parser:didStartElement:namespaceURI:qualifiedName:attributes:
parser:didEndElement:namespaceURI:qualifiedName:attributes:
to fire for the part of the following data:
<?xml version="1.0" encoding="ISO-8859-1"?><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/"><SOAP-ENV:Body><ns1:NDFDgenResponse xmlns:ns1=""><dwmlOut xsi:type="xsd:string"><?xml version="1.0"?>
<dwml version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">
(body excluded)
</dwml>
</dwmlOut></ns1:NDFDgenResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
I'm not an XML expert, but to me, the <dwml></dwml> part looks like just a regular element, to be parsed just like the parts before it.
I do get two parser:parseErrorOccurred: errors, #200 and #201, but they occur during the parsing of the <SOAP-ENV:Body> element, not the <dwml> element, so I'm not sure if they are relevant. Thanks for any help you can give me.
Update: A friend of mine has told me offline of several errors in the data above. I can't understand why NOAA would be sending out malformed XML though -- is there some secret to parsing it?
This is a SOAP web service, you might want to try this: http://code.google.com/p/wsdl2objc/
Related
I have been provided a WSDL by client at the beginning of the project, I ended up creating a request and response objects for given WSDL using SOAP UI, where the request object would look as follows,
<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:def="http://DefaultNamespace">
<soapenv:Header/>
<soapenv:Body>
<def:someOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">SOME_DATA</in0>
</def:someOperation>
</soapenv:Body>
</soapenv:Envelope>
But when the actual request coming from the production environment for the same wsdl is,
<?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:Body>
<someOperation xmlns="urn:SOMEService">
<in0>SOME_DATA</in0>
</someOperation>
</soap:Body>
</soap:Envelope>
If you observed the name spaces are the same but it does has difference for names like in 1st request its <soapenv:Envelope and same in the 2nd request is <soap:Envelope in each node of xml, the definition of operation is also different in both the request in 1st it is,
<def:someOperation soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">SOME_DATA</in0>
</def:someOperation>
and in 2nd it is,
<someOperation xmlns="urn:SOMEService">
<in0>SOME_DATA</in0>
</someOperation>
I do not know why the interpretation is different, and is it safe to have to change from 1st to 2nd.
IN both the cases actual operation is working fine I do not have any issues with that, it is just cant able to figure out reason of difference.
Could somebody please assist me with this or any direction to a document which could clarify my doubt would be great.
it does has difference for names like in 1st request its <soapenv:Envelope and same in the 2nd request is <soap:Envelope in each node of xml
Here soapenv and soap are local prefix names of namespace=http://schemas.xmlsoap.org/soap/envelope/. Hence, logically both are same and has no difference.
the definition of operation is also different in both the request in 1st v/s 2nd
In case of 1st, def:someOperation XML nodes belongs to namespace = xmlns:def="http://DefaultNamespace"
And in 2nd case, name space "urn:SOMEService" is directly defined with XML Nodes So
if DefaultNamespace is exactly same as SOMEService, the it means both of the XML Operation XMLs are same.
Hence,
soapenv v/s soap are same in your case.
Operations, you could conclude based on actual value of SOMEService v/s DefaultNamespace.
Hope it helps.
Hi Everyone!
I would like to get status from this response from Jmeter.How can i create regexp for that?
I just want to get 'vacant' from response
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns5:GetRandomMSISDNListResponse xmlns:ns2="http://www.trump.com/products/common/core" xmlns:ns3="http://www.trump.com/products/common/rr" xmlns:ns4="http://www.yota224.com/vux/domains/common/core" xmlns:ns5="http://www.yota224.com/vux/services/inventory">
<ns2:extension>
<ns2:item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:RequestContextType">
<ns2:correlationId>8f7ce7e1-31ae-40fe-82ba-4d59f634e599</ns2:correlationId>
</ns2:item>
</ns2:extension>
<msisdnList>
<homeRegion>1078</homeRegion>
<msisdn>9992146221</msisdn>
<status>vacant</status>
</msisdnList>
</ns5:GetRandomMSISDNListResponse>
</soap:Body>
</soap:Envelope>
If you targeting to do it via Regular Expressions - the relevant one would be something like:
<status>(\w+)</status>
Here is how it looks in the "RegExp Tester" mode of the View Results Tree listener
Also it might be easier to use XPath Extractor which is designed for working with XML data. In that case the relevant XPath query to get the status will be as simple as:
//status
I'm working with the SOAP API for Microsoft Dynamics CRM 4.0 and for the most part everything is working, but when I'm trying to count the number of total contacts in the database (or for particular queries), it's not respecting the TotalRecordCount=true flag.
Here is the SOAP request that I'm using:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<CrmAuthenticationToken xmlns="http://schemas.microsoft.com/crm/2007/WebServices">
...
</CrmAuthenticationToken>
</soap:Header>
<soap:Body>
<RetrieveMultiple xmlns="http://schemas.microsoft.com/crm/2007/WebServices">
<query xmlns:q1="http://schemas.microsoft.com/crm/2006/Query" xsi:type="q1:QueryExpression">
<q1:EntityName>contact</q1:EntityName>
<q1:Distinct>true</q1:Distinct>
<q1:PageInfo>
<q1:ReturnTotalRecordCount>true</q1:ReturnTotalRecordCount>
<q1:PageNumber>1</q1:PageNumber>
<q1:Count>1</q1:Count>
</q1:PageInfo>
</query>
</RetrieveMultiple>
</soap:Body>
</soap:Envelope>
But the response that I'm getting back still contains the following:
TotalRecordCount="-1" TotalRecordCountLimitExceeded="0"
Any idea what I'm doing wrong / missing here?
Do you get any results in your query? E.g. do you recieve the contact records?
I'm pretty sure I've had a problem with this type of approach in the past (using the paging information to get a count).
In any case you will probably have better luck with peforming a FetchXml query with an aggregate function (Im assuming your executing this Soap from JavaScript).
Jamie Miley has a good example of how to do this: http://mileyja.blogspot.co.uk/2011/06/aggregation-count-max-min-etc-and.html
There is a really good designer for FetchXml here: http://www.stunnware.com/
I am creating a class that will be utilizing the Fedex Web Services. I am attempting to communicate through the nusoap php class's nosoapclient() function, passing it a wsdl file. It seems Fedex requires a namespace attribute in the document root of a request.
I can use nusoap's call() function and pass it an XML string as the PARAMETER agrument which WILL WORK properly. I would rather pass an array through as the PARAMETER argument, and this is where I am running into an issue.
Is it possible to pass an array through nusoap's call() function and also include a namespace attribute in the root?
FEDEX RateRequest PHP exerpt
The following is to give an idea of what I am trying to do and not actual code
$client = new nusoapclient('RateRequest_v9.wsdl',true);
//Thought this would work but to no avail.
//$request_array is a multi-associative array with keys as required XML tag names and values as the tags inner value, did not include as it is irrelevant to this problem
//$root_attr = array('xmlns'=>'http://fedex.com/ws/rate/v9');
//$parameters = array('RateRequest'=>new soapval('RateRequest',false,$request_array,false,false,$root_attr));
$parameters = array('RateRequest'=>$request_array);
//Have tried with and without the third argument - which is the for the namespace
$response = $client->call('getRates',$parameters,'http://fedex.com/ws/rate/v9');
FEDEX RateRequest XML excerpt
The following is not the full XML (look at the RateRequest tag toward the end to see the difference)
INCORRECT FORMAT
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope 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:ns="http://fedex.com/ws/rate/v9"><SOAP-ENV:Body><RateRequest>...</RateRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
CORRECT FORMAT
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope 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:ns="http://fedex.com/ws/rate/v9"><SOAP-ENV:Body><RateRequest xmlns="http://fedex.com/ws/rate/v9">...</RateRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
My apologies in advance if I have missed this conversation elsewhere but I have been scouring the net and trying everything I could think of to make it work, if its not possible any suggestions? Thank you in advance for your assistance.
I'm using xpath and LibXML in an iPhone app to find some nodes in an xml document. I'm a noob in xpath so probably i am doing something wrong.
Here is the xml:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetUserByEmailResponse xmlns="http://tempuri.org/">
<GetUserByEmailResult>
<id>4006</id>
<name>Kudor Gyozo</name>
<email/>
<image/>
<facebookId>0</facebookId>
</GetUserByEmailResult>
</GetUserByEmailResponse>
</soap:Body>
</soap:Envelope>
The xpath expression is //GetUserByEmailResult. No nodes are returned. I expect to get <GetUserByEmailResult> back. If I test the same stuff here it works ok.
UPDATE1: This is what i get back from a .net web service. Is there a way to ignore namespaces in libxml?
I'm not familiar with the iphone library, but you'll probably have to declare the namsepace / prefix somewhere: If you register 'http://tempuri.org/' with 'someprefix', you can search for:
//someprefix:GetUserByEmailResult
A possible workaround is (but not advisable):
//*[local-name()='GetUserByEmailResult']
The GetUserByEmailResult element is in the http://tempuri.org/ namespace so you would need to add that namespace to your XPath search.
You can do so using the xmlXPathRegisterNs function:
xmlXPathRegisterNs(context, BAD_CAST "temp", BAD_CAST "http://tempuri.org/");
Then your XPath would have to be changed to
//temp:GetUserByEmailResult