How can I add WS-A adressing to a SOAP webservice-request via Robot Framework? - soap

I am new with Robot Framework and I run into a problem.
I try to call a web service that requires WSA (Web Service Addressing).
I tried sending a request while using SoapUI.
Sending a request via SoapUI provides a <wsa:Action>, a <wsa:RelatesTo> and a <wsa:MessageID> tag in the header when WSA is enabled.
Now I want to do the same with RobotFramework.
How can I inject these same tags via Robot Framework?
Here is my test
*** Settings ***
Library SudsLibrary
Library Collections
Library String
*** Test Cases ***
test
[Tags] blah
Create Soap Client C:${/}Robot WS${/}WS${/}wsdl${/}C60W30A.wsdl
Set Http Authentication MyUID MyPWD
${C60W30A}= Create Wsdl Object ns0:Invoer
${taimen}= Set Soap Headers "wsa:Action" GenBetKenmOperation
Set Wsdl Object Attribute ${C60W30A} Functie 04
Set Wsdl Object Attribute ${C60W30A} Bronsysteem COA
Set Wsdl Object Attribute ${C60W30A} Gebruiker WILLT10
${result}= Call Soap Method GenBetKenmOperation ${C60W30A}
Where the resulting XML is:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.MyCompany.nl/inning/coa/GenererenBetKenmerk" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns0:Body>
<ns1:GenererenBetKenm>
<Invoer>
<Functie>04</Functie>
<Bronsysteem>COA</Bronsysteem>
<Gebruiker>GeBrID</Gebruiker>
</Invoer>
</ns1:GenererenBetKenm>
</ns0:Body>
</SOAP-ENV:Envelope>
And the error:
FAIL : WebFault: Server raised fault: 'A required header representing a Message Addressing Property is not present'
As you can see the <wsa:Action> tag is missing. As wel are the other SOAP-header tags when I add them.

Related

Soap UI mock Missing operation for soapAction

I created SoapUI 5.7.0 mock with SSL and I am getting below exception. I set Require SOAP action to false in general mock properties, but I believe it only affects non - https mocks. HTTPs mock i created automatically when I mark SoapUI -> Preferences -> SSL Settings -> Enable SSL for mock services. But there seems not to be an option for marking Require SOAP action in SSL settins. Unfortunatelly I cannot change the Java code which is invoking this mock service.
Is there any way to make it working ?
javax.xml.ws.soap.SOAPFaultException: Response was of unexpected text/html ContentType. Incoming portion of HTML stream: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring>Missing operation for soapAction [http://xxxxx/v1/wsdl/aaa/bbb] and body element [{http://www.w3.org/2001/04/xmlenc#}EncryptedData] with SOAP Version [SOAP 1.1]</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

RPC Request for get-schema of bbf(broadband forum) yangs

I am trying below RPC request for module bbf-dot1q-types. but facing error like identifier is not found.
Please help me on this to what is the right RPC request for bbf yangs.
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
<identifier>bbf-dot1q-types</identifier>
</get-schema>
</rpc>
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<rpc-error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-severity>error</error-severity>
<error-info>
<err-element>identifier</err-element>
</error-info>
<error-message>
MINOR: MGMT_CORE #2301: Invalid element value
</error-message>
</rpc-error>
</rpc-reply>
Seems like the Netconf server handling your request does not have the bbf-dot1q-types module loaded. See RFC 6022, 3.1. The <get-schema> Operation:
If the requested schema does not exist, the <error-tag> is 'invalid-value'.
Make sure the Netconf server loads the module.

SudsLibrary in Robot Framework: Getting & Setting object attributes

I am working with the SudsLibrary for Robot Framework. Below is the Rq/Rs for the webservice I'm testing. You will also find the Robot Framework info and my comment on what's going on.
REQUEST
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sec="http://localhost/ABC/Services/Security/">
<soapenv:Header/>
<soapenv:Body>
<sec:AuthUser>
<sec:userName>MyAdmin</sec:userName>
<sec:password>Password123</sec:password>
</sec:AuthUser>
</soapenv:Body>
</soapenv:Envelope>
RESPONSE
<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" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.ompum-open.org/wss/2004/01/ompum-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.ompum-open.org/wss/2004/01/ompum-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
...
</soap:Header>
<soap:Body>
<AuthUserResponse xmlns="http://localhost/ABC/Services/Security/">
<AuthTicket>k3l5d9k6-3z53-8765-b512-df09as87</AuthTicket>
</AuthUserResponse>
</soap:Body>
</soap:Envelope>
*** Settings ***
Library SudsLibrary
*** Test Case ***
Check App Auth Ticket
Create Soap Client http://localhost/Services/Authentication.asmx?wsdl
${WSDLobj} Create Wsdl Object AuthUser
Set Wsdl Object Attribute ${WSDLobj} userName MyAdmin
Set Wsdl Object Attribute ${WSDLobj} password Password123
${result} Call Soap Method AuthUser ${WSDLobj}
log Result: ${result}
# Now get the specific element from the response
${AuthVal} Get Wsdl Object Attribute ${result} AuthTicket
log Auth Ticket: ${AuthVal}
Everything is successful in my test case Check App Auth Ticket until I call the SudsLibrary Get Wsdl Object Attribute keyword. The following error occurs: ValueError: Object must be a WSDL object (suds.sudsobject.Object). Why would I get an error when the object is created and is called successfully?
When I print out the ${result} variable, it is the value for AuthVal. However, I am wanting to explicitly extract a specific value / element from the web service response. I have other web service responses that will require me to parse this data for my end to end testing.

JMeter changing my namespace

I'm trying to use JMeter to invoke a RPC/SOAP Web service and when I invoke the service my namespaces are mangled from the actual values to NS1.
<?xml version="1.0" encoding="UTF-8"?>
<wpc:invoke xmlns:wpc="http://wpc.ibm.com">
<wpc:envelope communicationVersion="5.3">
<wpc:WPCResponseType>asynchronous</wpc:WPCResponseType>
<wpc:wpcHeader>
<wpc:companyName>mycompany</wpc:companyName>
<wpc:wpsUserID>me</wpc:wpsUserID>
<wpc:wpcUserID>wpcUsername</wpc:wpcUserID>
<wpc:password />
<wpc:messageIdentifier>9E2FA100-BE54-11E5-8A91-BF48E24665E0</wpc:messageIdentifier>
<wpc:timestamp>2016-01-18</wpc:timestamp>
<wpc:supplierId><![CDATA[0Z188]]></wpc:supplierId>
<wpc:localeForDisplay>en_US</wpc:localeForDisplay>
<wpc:localeRestriction>en_US</wpc:localeRestriction>
</wpc:wpcHeader>
<wpc:wpcBody>
<wpc:wpcCommand mode="ASYNC" type="UPLOAD">
<wpc:wpcCatalogName>Item Transaction Catalog</wpc:wpcCatalogName>
<wpc:wpcFileDocStorePath>test_data/upload/0003_items.csv</wpc:wpcFileDocStorePath>
<wpc:wpcUpdateOnly>false</wpc:wpcUpdateOnly>
</wpc:wpcCommand>
</wpc:wpcBody>
</wpc:envelope>
</wpc:invoke>
Changes to:
<?xml version="1.0" encoding="UTF-8"?>
<ns1:invoke xmlns:ns1="http://wpc.ibm.com">
<ns1:envelope communicationVersion="5.3">
<ns1:WPCResponseType>asynchronous</ns1:WPCResponseType>
<ns1:wpcHeader>
<ns1:companyName>mycompany</ns1:companyName>
<ns1:wpsUserID>me</ns1:wpsUserID>
<ns1:wpcUserID>wpcUsername</ns1:wpcUserID>
<ns1:password/>
<ns1:messageIdentifier>9E2FA100-BE54-11E5-8A91-BF48E24665E0</ns1:messageIdentifier>
<ns1:timestamp>2016-01-18</ns1:timestamp>
<ns1:supplierId><![CDATA[0Z188]]></ns1:supplierId>
<ns1:localeForDisplay>en_US</ns1:localeForDisplay>
<ns1:localeRestriction>en_US</ns1:localeRestriction>
</ns1:wpcHeader>
<ns1:wpcBody>
<ns1:wpcCommand mode="ASYNC" type="UPLOAD">
<ns1:wpcCatalogName>Item Transaction Catalog</ns1:wpcCatalogName>
<ns1:wpcFileDocStorePath>test_data/upload/0003_items.csv</ns1:wpcFileDocStorePath>
<ns1:wpcUpdateOnly>false</ns1:wpcUpdateOnly>
</ns1:wpcCommand>
</ns1:wpcBody>
</ns1:envelope>
</ns1:invoke>
There must be a setting in JMeter to keep the message from being transformed from my original meaningful namespace to this arbitrary namespace called NS1? When the message is received at the target endpoint it cannot parse the request because of this semantic error.
Any/all replies are appreciated!
MG
JMeter should not change anything in the request body, maybe it is an issues with your web service? Double check the request which is being sent by JMeter using a sniffer tool like Wireshark
In any case try switching to HTTP Request sampler, this is recommended way of sending web service requests (just don't forget to add HTTP Header Manager to send Content-Type and SOAPAction headers).
References:
JMeter User's Manual: Building a SOAP WebService Test Plan
Testing SOAP/REST Web Services Using JMeter

WNS template registration gets rejected from Azure Notification Hubs

I'm sending create or update template registration requests to my Azure Notification Hub using the REST API, but my requests always get rejected for template registrations for Windows Notification Service while it works for all other service types.
The body of my request looks correct to me, when I compare it with the documentation:
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<WindowsTemplateRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>SomeTag:1,TEST_REGISTRATION</Tags>
<ChannelUri>https://db3.notify.windows.com/?token=AgY7AABrfRCVgRV%2ba4DwoDjC2omrnOVwCkdhCrrzlJi6UpIwHzcig6%2fG5xZfnDqU0%2fXoE848ddiqyTaTlSSltp2Dn9Z3qaPsMAyh7kS%2bmlis1%2bwoh%2b%2b4DsAK1yeV1d9G1rUIuFs%3s</ChannelUri>
<BodyTemplate><![CDATA[<?xml version="1.0" encoding="utf-8" ?><data><title>$(title_en)</title><message>$(message_en)</message><notificationType>1</notificationType></data>]]></BodyTemplate>
<WnsHeaders>
<WNSHeader>
<Header>X-WNS-Type</Header>
<Value>wns/raw</Value>
</WNSHeader>
</WnsHeaders>
</WindowsTemplateRegistrationDescription>
</content>
</entry>
ANH always returns the response code 400 (Invalid request body. The registration could not be created because the request was malformed.), but using this format works for all other service types (e.g. GCM, MPNS) and I can create a WNS template registration manually using the Service Bus Explorer with the exact same ChannelUri, template and WnsHeaders.
What else could be wrong here? Is there any way to debug this?
Found the answer in this question: What does the following Azure Notification Hub REST response mean: 'The specified resource description is invalid.'?
"WNSHeader" needs to be written in Pascal case, like this: "WnsHeader", so the documentation is not 100% correct...