Karate - How can we see the exact request and input parameters sent when the request in feature file is called from a file - soap

Karate - How can we see the exact request and input parameters sent when the request is called from a file and input parameters are coming through CSV file
In the HTML report - at the given request step,whole of the request with input parameters is displayed if the request has been put in the feature file.
HTML Report:
**Test 49 : Given request**
<?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>
<Add xmlns="http://tempuri.org/">
<intA>2</intA>
<intB>6</intB>
</Add>
</soap:Body>
</soap:Envelope>
whereas, if the request had been put into an XML file and then called by using the XML in the feature file then it does not display the whole of the request in the HTML report.
For Example- Feature File:
Given request read('classpath:RequestFiles/AddRequest.xml')
HTML Report just displays the test step as:
"Test 86 : When soap action 'http://tempuri.org/Add'"
Is anyone aware of the way to display the whole of request with input parameters if the request(in the feature file) is called from a XML file?

There is a simple way to put anything in what you refer to as the Doc String section of the report. Just print it.
* print someVarYouReadFromAFile
Also note that HTTP requests and responses will appear in the report by default, and most teams are fine with it. If you don't see this, there may be some other problem.
Finally a word of advice. I see many teams focus too much on time on making the reports "pretty". I would focus more on the question "am I able to test more scenarios and detect failures ?".

Related

SOAP request with certain tags without namespace

Would be the following SOAP request valid according to the standard?
<?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>
<ns2:ServiceReq xmlns:ns2="http://www.tibco.com/service" xmlns:ns1="http://www.tibco.com/framework">
<ns1:HeaderIn>
<ns1:countryISO>FR</ns1:countryISO>
<ns1:callerDateTime>2021-11-26T15:50:08.742Z</ns1:callerDateTime>
</ns1:HeaderIn>
<ns2:request>
<entete>
<profile>Default</profile>
</entete>
<input>
<type>W</type>
<codeRegion>X</codeRegion>
</input>
</ns2:request>
</ns2:ServiceReq>
</soapenv:Body>
</soapenv:Envelope>
I am not sure because certain tags don't have a namespace
There are multiple levels of valid here:
Is it a valid SOAP message as per the SOAP standard? Yes. The SOAP envelope and body tags seem valid.
Is it a valid XML format? Yes, it's a well formed XML file.
Are those elements without a namespace prefix valid? Yes. Elements can be in a default namespace or in no namespace at all.
Is the actual content of the body a valid messages? You can only tell if you verify the message you posted against the expected message as defined in the WSDL file of the web service.
All the elements in the body of the SOAP message should belong to specific namespaces, but sometimes a developer forgets to add a namespace annotation on the element, or copy-pastes something from some place else, or whatever, and you end up with weird looking XMLs like that. The service works and the message is correctly parsed, but it just looks funny.

EWS Soap Request how to search for contact based on name and email only

I have a soap request like this, based on microsoft website
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://someurl"
xmlns:xsd="http://someurl"
xmlns:m="http://someurl"
xmlns:soap="http://someurl"
xmlns:t="someurl">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP2" />
</soap:Header>
<soap:Body>
<m:ResolveNames ReturnFullContactData="true" ContactDataShape="AllProperties">
<m:UnresolvedEntry>hart</m:UnresolvedEntry>
</m:ResolveNames>
</soap:Body>
</soap:Envelope>
as it is, it will returned a lot of stuff, because it will search "hart" on everywhere such as city, email, name, etc.
How can I specify so it search scope only on email or name only.
the soap request example is based on this link
https://msdn.microsoft.com/en-us/library/office/jj190905%28v=exchg.150%29.aspx
"If you don't know the email address of the user for whom you are getting a photo, you can use the ResolveNames operation to get candidates for a possible match. If you specify "AllProperties" for the ContactDataShape attribute of the ResolveNames element, a lot of data, including user photos, will be returned for each candidate. The following example shows the XML request to resolve the name "Sadie" and return all the properties for each candidate."
If you want to limit the fields searched, you should look at using the FindItem operation rather than ResolveNames.

Getting 400 Bad Request while trying to upload contents to sharepoint site using Copy.asmx web service

I am trying to upload content to SharePoint site using its Copy.asmx web service's CopyIntoItems operation from one of my iPhone applications.
Here is the sample xml That I am trying to POST.
<?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>
<CopyIntoItems xmlns="http:"//schemas.microsoft.com/sharepoint/soap/"><SourceUrl>http://null</SourceUrl><DestinationUrls><string>mytestsite/Upload Library/Check_File_Upload.txt</string></DestinationUrls><Fields><FieldInformation Type="File" DisplayName="Name" InternalName="FileLeafRef" Value="Check_File_Upload.txt" /><FieldInformation Type="Guid" DisplayName="GUID" InternalName="GUID" Value="{21026DFC-E19E-470E-8B1D-7D7C5FA84FF3}" /></Fields><Stream>VGhpcyBpcyBhIHRlc3QgZmlsZSB0byBjaGVjayB1cGxvYWQgZnVuY3Rpb25hbGl0eS4gYW5kIGNoZWNraW5nIGFnYWluLg==</Stream></CopyIntoItems>
</soap:Body>
</soap:Envelope>
Can anyone help me to figure out the issue?
I'm was able to do it with Java. See this thread
Gettting 400 Bad Request while uploading file to SharePoint 2010 using Copy.CopyIntoItems web service
Hope this helps.
Also here are some very useful field type that I've compiled. I'm using SharePoint 2010
Choice List
fieldInfo.setDisplayName("Day Of Week");
fieldInfo.setType(FieldType.CHOICE);
fieldInfo.setValue("Friday");
Multi Choice List, note that each value is separated by ;#
fieldInfo.setDisplayName("Hobbies");
fieldInfo.setType(FieldType.MULTI_CHOICE);
fieldInfo.setValue("Biking;#Reading");
Enterprise Keywords,
fieldInfo.setDisplayName("Enterprise Keywords");
fieldInfo.setType(FieldType.NOTE);
fieldInfo.setValue("-1;#wind;#-1;#turbine");
Managed Metadata. Important, note that the displayname must be append to “_0” and the value must be in the format of -1#SomeValue|guid as shown below
fieldInfo.setDisplayName("MyMetadata_0");
fieldInfo.setType(FieldType.NOTE);
fieldInfo.setValue("-1;#wind|4c29faf0-bea6-4032-893f-d5aaea458728;#-1;#turbine|6e552448-77d1-4349-bc11-52debdcbc860");
Content Type. You can get the Id of the content type by viewing on the content type properties and note the id in the url, something like. Get the value of the param, ctype https://eimsscnqa.sandia.gov/sites/DocLib026/_layouts/ManageContentType.aspx?ctype=0x0101005C02449B3F60DF42A78192F51AAD4A5202e
fieldInfo.setDisplayName("Content Type Id");
fieldInfo.setType(FieldType.TEXT);
fieldInfo.setValue("0x0101005C02449B3F60DF42A78192F51AAD4A5202e");

iphone xml parsing error

Hello all in my iphone application after sending login xml request am getting following faulted xml... but i cant understand what the error is...
<?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><SOAP-ENV:Fault><faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultactor xsi:type="xsd:string"></faultactor><faultstring xsi:type="xsd:string">error in msg parsing:
Charset from HTTP Content-Type &apos;UTF-8&apos; does not match encoding from XML declaration &apos;ISO-8859-1&apos;</faultstring><detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Well, the error message is saying that you tried to parse a document where the document header said it was encoded in ISO 8859/1, while the HTTP header said it was in UTF-8. Parsers are allowed to resolve that conflict by giving the HTTP header precedence, but it seems this parser chose not to. The inconsistency means there's some kind of configuration problem and it needs to be investigated.

Is it possible to add an attribute to an XML Root using nusoap's call() function?

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.