calculating mac for wsp header - gsm

I am trying to get mac value for wsp header, according documentation S40 OMA client Provisioning doc, page 36 of Appendix B (http://sorrytesting.googlecode.com/files/Series_40_DP_2_0_OMA_Client_Provisioning_v1_3_en.pdf)
1) I 've got this wbxml:
1. I considered the below XML:
<?xml version="1.0"?>
<!DOCTYPE wap-provisioningdoc PUBLIC "-//WAPFORUM//DTD PROV 1.0//EN" “http://www.wapforum.org/DTD/prov.dtd">
<wap-provisioningdoc version="1.0">
<characteristic type="NAPDEF">
<parm name="NAPID" value="inet"/>
<parm name="NAME" value="InternetNAPDEF"/>
<parm name="BEARER" value="GSM-GPRS"/>
<parm name="NAP-ADDRESS" value="internet"/>
<parm name="NAP-ADDRTYPE" value="APN"/>
<parm name="INTERNET"/>
</characteristic>
<characteristic type="APPLICATION">
<parm name="APPID" value="w2"/>
<parm name="TO-NAPID" value="inet"/>
<characteristic type="RESOURCE">
<parm name="URI" value="http://wap.krak.dk"/>
<parm name="STARTPAGE"/>
</characteristic>
</characteristic>
<characteristic type="BOOTSTRAP">
<parm name="NAME" value="Sonofon Browser"/>
</characteristic>
</wap-provisioningdoc>
2)I have got WbXML file:
030B6A05 696E6574 00C54601 C6550187 ..j. inet ..F. .U..
11068300 01870706 03496E74 65726E65 .... .... .Int erne
744E4150 44454600 01871006 AB018708 tNAP DEF. .... ....
0603696E 7465726E 65740001 87090689 ..in tern et.. ....
01871401 01C60001 55018736 00000603 .... .... U..6 ....
77320001 87220683 0001C600 01590187 w2.. .".. .... .Y..
3A000006 03687474 703A2F2F 7761702E :... .htt p:// wap.
6B72616B 2E646B00 01871C01 0101C656 krak .dk. .... ...V
01870706 03536F6E 6F666F6E 2042726F .... .Son ofon Bro
77736572 00010101 wser ....
Series
3)With help of HashCalc I have got sha1 string d0e034c0864e5e72dfea6e3b43022a32b239af76
4) In hex it is : 64306530333463303836346535653732646665613665336234333032326133326232333961663736
But in document it is : 4430453033344330383634453545373244464541
3645334234333032324133324232333941463736
How they did it?

Related

WSO2 : Transforming response xml

I would like to turn this xml response into something more easily readable.
<?xml version="1.0" encoding="ISO-8859-1"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body>
<executeResponse xmlns="urn:GCE">
<BusinessViewServiceexecuteOut xmlns="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" xmlns:ns2="http://www.generixgroup.com/processus/configuration/scheduler" xmlns:ns3="http://www.generix.fr/technicalframework/business/service/common">
<xmlpres><?xml version = '1.0' encoding = 'UTF-8'?> <VueTable type="View" name="Table" habctr="true" total_business_row="2" nbline="400" confNbline="400" numpage="1" nbpage="1">
<JTblView name="JTblView" type="ViewObject" maxfetchsize="999" maxfetchsizeexceeded="false">
<JTblViewRow current="true" type="ViewRow" index="1" business_row_index="1">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>N</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Non</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Non</business_data>
</Lir>
</JTblViewRow>
<JTblViewRow type="ViewRow" index="2" business_row_index="2">
<Cletbl precision="6" type="VARCHAR" pk="true">
<business_data>O</business_data>
</Cletbl>
<Codtbl precision="6" type="VARCHAR" pk="true">
<business_data>001</business_data>
</Codtbl>
<Lib1 precision="30" type="VARCHAR">
<business_data>Oui</business_data>
</Lib1>
<Lib2 precision="30" type="VARCHAR">
<business_data/>
</Lib2>
<Lir precision="10" type="VARCHAR">
<business_data>Oui</business_data>
</Lir>
</JTblViewRow>
</JTblView>
</VueTable></xmlpres>
</BusinessViewServiceexecuteOut>
</executeResponse>
</soap:Body></soap:Envelope>
At least if I could extract what's in the value of "xmlpres", the better I could do:
<table><row><code></code><libelle></libelle/></row></table>
To then turn it into a json response but I can't see ... I just get all the output or in json stream but with everything , which is not usable.
Create an out-mediation sequence with the following content and attach it to the respective API and try out the scenario. This is to extract the xmlpres content and send that as the response to the client
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="out-sequence">
<!-- extract the xmlpres content and store as OM element -->
<property name="XMLBody"
expression="$body//soap:Body//generic:xmlpres"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:gce="urn:GCE"
xmlns:generic="http://www.generix.fr/technicalframework/businesscomponent/applicationmodule/common" type="OM" />
<!-- pass the extracted property as response body -->
<enrich>
<source type="property" property="XMLBody" />
<target type="body" />
</enrich>
</sequence>
Hope this helps you to extract and send the response accordingly.

Sabre PassengerDetailsRQ not return the ID attribute in ItineraryRef

I am trying to book an air segment using EnhancedAirBookRQ and PassengerDetailsRQ using development endpoint.
But in the response I did not get the ID it just sending the information like
<ItineraryRef AirExtras="false" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
but i should return like <ItineraryRef AirExtras="false" ID="DJEJWQ" InhibitCode="U" PartitionID="AA" PrimeHostID="1S">
Is there any reason for this? bellow is my request XML code.
<PassengerDetailsRQ xmlns="http://services.sabre.com/sp/pd/v3_4" version="3.4.0">
<PostProcessing >
<RedisplayReservation waitInterval="1000"/>
</PostProcessing>
<PreProcessing />
<SpecialReqDetails>
<SpecialServiceRQ>
<SpecialServiceInfo>
<AdvancePassenger SegmentNumber="A">
<Document ExpirationDate="2018-05-26" Number="1234567890" Type="P">
<IssueCountry>FR</IssueCountry>
<NationalityCountry>FR</NationalityCountry>
</Document>
<PersonName DateOfBirth="1980-12-02" Gender="M" NameNumber="1.1">
<GivenName>JAMES</GivenName>
<MiddleName>MALCOLM</MiddleName>
<Surname>GREEN</Surname>
</PersonName>
</AdvancePassenger>
</SpecialServiceInfo>
</SpecialServiceRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ>
<AgencyInfo>
<Address>
<AddressLine>SABRE TRAVEL</AddressLine>
<CityName>SOUTHLAKE</CityName>
<CountryCode>US</CountryCode>
<PostalCode>76092</PostalCode>
<StateCountyProv StateCode="TX"/>
<StreetNmbr>3150 SABRE DRIVE</StreetNmbr>
<VendorPrefs>
<Airline Hosted="true"/>
</VendorPrefs>
</Address>
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber NameNumber="1.1" Phone="817-555-1212" PhoneUseType="H"/>
</ContactNumbers>
<PersonName NameNumber="1.1" NameReference="ABC123" PassengerType="ADT">
<GivenName>MALCOLM</GivenName>
<Surname>GREEN</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
Thanks

ejabberd reports bad request/modify when attempting to delete user

I'm trying to delete user using ejabberd yet I'm receiving 400/modify bad-request error. The stanzas sent by Smack are by the spec [1] as far as I can tell; it also works fine with OpenFire.
Ejabberd runs in rroemhild/docker-ejabberd docker container version 17.03-1 (the latest available; for reasons why I am not using the processone container see [2]) with the config file being stock from there (sections removed; full copy at [3])
hosts:
- "xmppserver.com"
auth_method:
- internal
acl:
admin:
user:
- "admin": "xmppserver.com"
- "adminaccount": "xmppserver.com"
local:
user_regexp: ""
access:
(nothing of interest here)
modules:
mod_adhoc: {}
host_config:
"xmppserver.com":
domain_certfile: "/opt/ejabberd/ssl/xmppserver.com.pem"
(Yes, I will properly configure SSL once I verify it works for me)
First I confirm the user is authorised to issue admin commands:
SENT
<iq to='xmppserver.com' id='Ghtu9-15' type='get'>
<query xmlns='http://jabber.org/protocol/disco#items' node='http://jabber.org/protocol/commands'/>
</iq>
RECEIVED
<iq xml:lang='en' to='appserver#xmppserver.com/39058022031067483561501494598609310' from='xmppserver.com' type='result' id='Ghtu9-15'>
<query node='http://jabber.org/protocol/commands' xmlns='http://jabber.org/protocol/disco#items'>
...
<item node='http://jabber.org/protocol/admin#add-user' name='Add User' jid='xmppserver.com'/>
<item node='http://jabber.org/protocol/admin#delete-user' name='Delete User' jid='xmppserver.com'/>
...
</query>
</iq>
As you can see the delete-user command is listed as available. Then I proceed to delete a user:
SENT
<iq to='xmppserver.com' id='2vM3f-17' type='set'>
<command xmlns='http://jabber.org/protocol/commands' action='execute' node='http://jabber.org/protocol/admin#delete-user'></command>
</iq>
RECEIVED
<iq xml:lang='en' to='adminaccount#xmppserver.com/163923254889085958281501260654263394' from='xmppserver.com' type='result' id='2vM3f-17'>
<command status='executing' sessionid='2017-07-28T16:51:12.784282Z' node='http://jabber.org/protocol/admin#delete-user' xmlns='http://jabber.org/protocol/commands'>
<actions execute='complete'>
<complete/>
</actions>
<x type='form' xmlns='jabber:x:data'>
<title>Delete User</title>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/admin</value>
</field>
<field var='accountjids' type='jid-multi' label='Jabber ID'>
<required/>
</field>
</x>
</command>
</iq>
Here I'm not sure what the <actions...> tag is about; it's not mentioned in XEP-133. Other than that the form looks good.
SENT
<iq to='xmppserver.com' id='2vM3f-19' type='set'>
<command xmlns='http://jabber.org/protocol/commands' sessionid='2017-07-28T16:51:12.784282Z' node='http://jabber.org/protocol/admin#delete-user'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/admin</value>
</field>
<field var='accountjids' type='jid-multi'>
<value>jid#xmppserver.com</value>
</field>
</x>
</command>
</iq>
RECEIVED
<iq xml:lang='en' to='adminaccount#xmppserver.com/163923254889085958281501260654263394' from='xmppserver.com' type='error' id='2vM3f-19'>
<command sessionid='2017-07-28T16:51:12.784282Z' node='http://jabber.org/protocol/admin#delete-user' xmlns='http://jabber.org/protocol/commands'>
<x type='submit' xmlns='jabber:x:data'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/admin</value>
</field>
<field var='accountjids' type='jid-multi'>
<value>jid#xmppserver.com</value>
</field>
</x>
</command>
<error code='400' type='modify'>
<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
I also tried sending bare JIDs (i.e. without the hostname part) but the result is the same.
This is not a particularly helpful error message.
What am I doing wrong?
[1] https://xmpp.org/extensions/xep-0133.html#delete-user
[2] https://github.com/processone/ejabberd/issues/1890
[3] https://pastebin.com/5D0rEbFR
Apparently <error code='400' type='modify'> is eJabberD's way of saying 'user not found, nothing to delete'.

XQUERY: How to search for XML tag with multiple name values

I'm new to XQuery.
I have two files- input.xml and config.xml, I want to be able to search the input.xml file and check if ALL config.xml soffs are in the input.xml
Using the example below, I want to check if soff=ABC and soff=DEF and soff=GHI exist in input.xml and if all three are found in the input.xml I want to return the subscribergroup value in the config.xml WITHOUT HARDCODING
Here's my input.xml ...
<SOFF SOFNO="3732" NAME="ABC" ACTION="X">
<OPNOKEY>
<OPNO>00042</OPNO>
<OPNO>00045</OPNO>
<OPNO>00069</OPNO>
<OPNO>00103</OPNO>
</OPNOKEY>
<PARMS QTY="3">
<PARM NAME="#NEW" VALUE="3" ACTION="A"/>
<PARM NAME="#NEW" VALUE="0" ACTION="R"/>
<PARM NAME="#OLD" VALUE="3" ACTION="X"/>
</PARMS>
<ATTRS QTY="0"/>
</SOFF>
<SOFF SOFNO="3735" NAME="DEF" ACTION="R">
<OPNOKEY>
<OPNO>00042</OPNO>
<OPNO>00045</OPNO>
<OPNO>00069</OPNO>
<OPNO>00103</OPNO>
<OPNO>00104</OPNO>
</OPNOKEY>
<PARMS QTY="1">
<PARM NAME="INSTL" VALUE="GHI" ACTION="R"/>
</PARMS>
<ATTRS QTY="0"/>
</SOFF>
<SOFF SOFNO="2959" NAME="STB3" ACTION="R">
<OPNOKEY>
<OPNO>00042</OPNO>
<OPNO>00045</OPNO>
<OPNO>00069</OPNO>
<OPNO>00103</OPNO>
<OPNO>00104</OPNO>
<OPNO>00105</OPNO>
</OPNOKEY>
<PARMS QTY="0"/>
<ATTRS QTY="0"/>
</SOFF>
<SOFF SOFNO="2958" NAME="JKL" ACTION="R">
<OPNOKEY>
<OPNO>00042</OPNO>
<OPNO>00045</OPNO>
<OPNO>00069</OPNO>
<OPNO>00103</OPNO>
<OPNO>00104</OPNO>
<OPNO>00106</OPNO>
</OPNOKEY>
<PARMS QTY="0"/>
<ATTRS QTY="0"/>
</SOFF>
<SOFF SOFNO="2957" NAME="MNO" ACTION="R">
<OPNOKEY>
<OPNO>00042</OPNO>
<OPNO>00045</OPNO>
<OPNO>00069</OPNO>
<OPNO>00103</OPNO>
<OPNO>00104</OPNO>
<OPNO>00107</OPNO>
</OPNOKEY>
<PARMS QTY="0"/>
<ATTRS QTY="0"/>
</SOFF>
<SOFF SOFNO="3349" NAME="PQR" ACTION="A">
<OPNOKEY>
<OPNO>00042</OPNO>
<OPNO>00045</OPNO>
<OPNO>00069</OPNO>
<OPNO>00103</OPNO>
<OPNO>00110</OPNO>
</OPNOKEY>
<PARMS QTY="0"/>
<ATTRS QTY="0"/>
</SOFF>
Here's my config.xml ...
<?xml version="1.0" encoding="UTF-8"?>
<subscriptionmappings>
<soff name="ABC">
<mandatorysoffs>
<soff name="DEF"/>
<soff name="GHI"/>
</mandatorysoffs>
<subscribergroup>sVOD-KidsSuite</subscribergroup>
</soff>
</subscriptionmappings>
Here's as far as I get, I can't seem to figure out how to check for multiple soff's within where clause, I assume I need a for-loop or something similar ...
For $i in $config/mandatorysoffs/soff
where ($input/SOFF/#NAME = $config/soff/#name
and $input/SOFF/#NAME = $config/mandatorysoffs/soff/#name
and $input/SOFF/#NAME = $config/mandatorysoffs/soff/#name )
return $config/subscribergroup/text()
It appears that you want to return a <subscribergroup> value for every <soff> in your config for which the name of every child of <mandatorysoffs> exists as a SOFF/#NAME in the input. Using a universal quantifier in the where clause:
for $s in $config/soff
where
every $n in $s/mandatorysoffs/soff/#name
satisfies ($n = $input/SOFF/#NAME)
return $s/subscribergroup/string()
Note that in your example GHI is a PARM/#VALUE so it still returns empty.
You can just check for the occurrence of each soff from the first document in the second document and then make sure that none of them are missing (i.e. false):
xquery version "1.0";
let $chk-soffs := doc("config.xml")//soff/string(#name)
let $soffs := doc("input.xml")//SOFF/string(#name)
return
let $results := for $soff in $soffs
return
$chk-soffs = $soff
return
not($results = false())
or if you have access to a processor that supports XQuery 3.0:
xquery version "3.0";
let $chk-soffs := doc("config.xml")//soff/string(#name)
let $soffs := doc("input.xml")//SOFF/string(#name)
return
let $results := $soffs ! $chk-soffs = .
return
not($results = false())

.net to coldfusion web service xml parsing

I'm almost there with this project. Given the xml below:
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<debtor xmlns="http://tempuri.org/Database.xsd">
<Customer diffgr:id="Customer1" msdata:rowOrder="0" diffgr:hasErrors="true">
<SeqNo>-1</SeqNo>
<AccGroup>1</AccGroup>
<AccountTypeID>1</AccountTypeID>
<CompaniesOfficeID>-4</CompaniesOfficeID>
<DOB />
<SignupDate>18/04/2007</SignupDate>
<DeferredDate />
<TeleSalesNo>5</TeleSalesNo>
<PIN>4433</PIN>
<Name>MR DAVID GETTI</Name>
<Salutation>MR</Salutation>
<FirstName>DAVID</FirstName>
<LastName>GETTI</LastName>
<Phone>64 7 555 522</Phone>
<Fax />
<CellPhone>64 25 999 999</CellPhone>
<Email>dave.getti#cpass.net.nz</Email>
<AfterHrs_Contact />
<SalesNo>0</SalesNo>
<CreditStatus>1</CreditStatus>
<RefGroupNo>0</RefGroupNo>
<PriceNo>-1</PriceNo>
<SmartLineProvider>-1</SmartLineProvider>
<Contact>DAVID GETTI</Contact>
<CustomerCode>1111111</CustomerCode>
<HasCellPhone>false</HasCellPhone>
<InvoiceOptions>12</InvoiceOptions>
<TradingAs>MR DAVID GETTI</TradingAs>
<FranchiseCode>-1</FranchiseCode>
<Existing>true</Existing>
<Address diffgr:id="Address1" msdata:rowOrder="0">
<SeqNo>-1</SeqNo>
<CustomerSeqNo>-1</CustomerSeqNo>
<Show>30</Show>
<TypeSelected>2</TypeSelected>
<Name>PostalAddress</Name>
<AddressNumber />
<Address1>88 Blue Lane East</Address1>
<Address2>REMA</Address2>
<Address3>AKL</Address3>
<Address4 />
<PostCode>1050</PostCode>
<LocationCode>0</LocationCode>
<AgentID>0</AgentID>
</Address>
<Address diffgr:id="Address2" msdata:rowOrder="1">
<SeqNo>-2</SeqNo>
<CustomerSeqNo>-1</CustomerSeqNo>
<Show>10</Show>
<TypeSelected>2</TypeSelected>
<Name>PhysicalAddress</Name>
<AddressNumber />
<Address1>44 OHINA STREET</Address1>
<Address2>REMA</Address2>
<Address3>AKL</Address3>
<Address4 />
<PostCode>1098</PostCode>
<LocationCode>1</LocationCode>
<AgentID>1</AgentID>
</Address>
I can access all the data, except the address details and populate a query object, using the code below:
<cfset Local.xRows = Local.xData["diffgr:diffgram"]["debtor"] />
<cfloop from="1" to="#arrayLen(Local.xRows.xmlChildren)#" index="Local.i">
<cfset Local.thisRow = Local.xRows.xmlChildren[Local.i] />
<cfset Local.tableName = Local.thisRow.xmlName />
<cfset queryAddRow(Local.result[Local.tableName], 1) />
<cfloop from="1" to="#arrayLen(Local.thisRow.xmlChildren)#" index="Local.j">
<cfif listfindnocase(vCols,Local.thisRow.xmlChildren[Local.j].xmlName)>
<cfset querySetCell(Local.result[Local.tableName], Local.thisRow.xmlChildren[Local.j].xmlName, Local.thisRow.xmlChildren[Local.j].xmlText, Local.result[Local.tableName].recordCount) />
</cfif>
</cfloop>
</cfloop>
However, I am stuck with how to access the individual address detail nodes under the main address node:
<Address diffgr:id="Address1" msdata:rowOrder="0">
Any help would be greatly appreciated.
I think you're trying to reference those individual nodes using an absolute reference instead of the easier local reference you get by using cfloop.
<cfset xmlCustomerInfo = xmlDoc.info[ "Customer" ][ Local.i ] />
<cfset arrAddressList = xmlCustomerInfo[ "Address" ] />
<cfloop
index="Local.j"
from="1"
to="#ArrayLen( arrAddressList )#"
step="1">
<cfset innerAddressNode = arrAddressList[ Local.j ] />
</cfloop>
Here are some great references to parsing XML in Coldfusion.
WARNING: Code is un-tested, just based on what you presented and how coldfusion parses Xml documents.

Resources