stylesheet cache using XML management interface is not working - ibm-datapower

I am trying to flush the stylesheet cache using XML management Interface (SOMA).
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="http://www.datapower.com/schemas/management">
<soapenv:Header/>
<soapenv:Body>
<man:request domain="mydomain">
<man:do-action>
<FlushStylesheetCache>
<XMLManager class="default"></XMLManager>
</FlushStylesheetCache>
</man:do-action>
</man:request>
</soapenv:Body>
</soapenv:Envelope>
Getting error <log-event level="error">Stylesheet name '' is not valid</log-event>

I think you have given wrong class type and null object name.
<man:do-action>
<FlushStylesheetCache>
<XMLManager class="XMLManager">default</XMLManager>
</FlushStylesheetCache>
</man:do-action>
class value can be null. As it is option value for this request. You should have XML Management access to flush the cache using XML management interface

Related

JSON to Specific XML format convertion in Web API

I am going to build a Web API in ASP.Net Core,which Consist of Multiple external Api Calls.
My Api take the request and response as "JSON".But some External Api's only works with XML.Now,I am stuck with converting json to XML in an Api Scenario.More details as follows:
My Api Recieving Request as (Json):
{
"Credential":"mrtest:testpw123,
"BookId": 6,
"BookName": "XXX",
"BookAuthor": "yyy yyy",
"BookPrice":512
}
And I want to Post this same information to an External Api as:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:tns="http://kkr.eu/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<tns:Credential xsi:type="tns:CredentialPro">
<tns:UserName>mrtest</tns:UserName>
<tns:Password>testpw123</tns:Password>
<tns:UserID>4</tns:UserID>
</tns:Credential>
</soap:Header>
<soap:Body>
<tns:AddBookDetails>
<tns:BookId>6</tns:BookId>
<tns:BookName>XXX</tns:BookName>
<tns:BookAuthor>yyy yyy</tns:BookAuthor>
<tns:BookPrice>512</tns:Price>
</tns:AddBookDetails>
</soap:Body>
</soap:Envelope>
So I want to Convert Json to XML in above Format.
Is there Any way to do this Simply?
How I Build "tns:UserName,tns:BookId,.." Like tags from Json??
Also Confused About Namespaces including in XML tags.
As I am beginner on Web API Hope you guys Help me..

Sabre API *A OR *IM command equivalent

PNR not created on DELTA carrier, need assistance
I'm receiving this warning on PassengerDetailsRQ
DIRECT CONNECT MESSAGES RECEIVED - ENTER *A OR *IM
All pricing is extracted ok and Segment status is HK but PNR is not generated((
Could you please tell me what will be Sabre API equivalent for *A OR *IM commands and how to fight this issue.
Assuming you are using XML services you may try to run SabreCommandLLSRQ which is responsible for running commands. Exact command instruction is put in <HostCommand> node. Example for IM command below (header section is empty for verbosity)
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<!-- Header content -->
</soap:Header>
<soap:Body>
<SabreCommandLLSRQ xmlns="http://webservices.sabre.com/sabreXML/2003/07" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" TimeStamp="2014-03-04T14:00:00" Version="1.8.1">
<Request Output="SCREEN" CDATA="true">
<HostCommand>IM</HostCommand>
</Request>
</SabreCommandLLSRQ>
</soap:Body>
</soap:Envelope>
As mentioned you can use the SabreCommandLLSRQ to run exact host commands specified in the error message but the equivalent web service command for *A would be TravelItineraryReadRQ with a FULL subject area (and no UniqueID specified).
After retrieving the PNR again you can simply EndTransactionLLSRQ again.

Apache Oltu Linkedin Integration example

I am looking forward to developed the Spring MVC + Apache Oltu + Linkedin integration example. In this example, you need to send Client ID and Client Secret to access the private resource from the Linked in Site.
First Step - we need to create App in Linkedin, follow the steps: http://codeboxr.com/how-to-create-linkedin-app.html
Once App is created, you need to make sure you've given value for the redirect URL.
In the java code I used
setScope("r_network w_share r_basicprofile")
setState("987654321")
When I used the following code:
request= new OAuthBearerClientRequest("https://api.linkedin.com/v1/people/").buildQueryMessage();
I get the following errror. Could anyone please?
Could not access resource: 401 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
<status>401</status>
<timestamp>1429554559432</timestamp>
<request-id>QJWNLL5PWX</request-id>
<error-code>0</error-code>
<message>Unknown authentication scheme</message>
</error>
An important thing, I am getting correct details below, but seems accessing private resources:
{"access_token":"SQXZVmVM05AOzDB_DdBm5iaJkrEC8oK-FgE1m1snEZbMcKUODew9I0ZQ6NWc8JtGDxTtEd-yyPul0FtF3-hG4ah6LZ9P4oaSVuhhtybRFmjfsZcJwOs5Lm2IDUGQnjmq5EdT3PVR7Bocq31VBXg0JtkQdImab945oicO_w2j6CjlByp-bWw",
"expires_in":5108376}
It seems that you're successfully obtaining an OAuth 2.0 access token, you'll need to pass access_token in a query parameter when making API calls. That's how OAuth 2.0 authentication is handled (OAuth 1.0 required the access token to be in the header whereas OAuth 2.0 relies on a query parameter).
For example:
GET https://api.linkedin.com/v1/people/~?oauth2_access_token={your-access-token}
Please follow the link, if in case requires more details: https://developer-programs.linkedin.com/forum/unknown-authentication-scheme
If you send token along with the request to access protected resources, then you should be getting the following details.
The corrected code snippet:
request= new OAuthBearerClientRequest
("https://api.linkedin.com/v1/people/~?oauth2_access_token="+oAuthResponse.getAccessToken()).
buildQueryMessage();
In My Example, I am getting the following HTTP 200 OK response, just wanted to show you..
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
<id>LLIyXMKhNI</id>
<first-name>FirstName</first-name>
<last-name>LastName</last-name>
<headline>Spring Developer at Amazon</headline>
<site-standard-profile-request>
<url>https://www.linkedin.com/profile/view?id=154416688&authType=name&authToken=ipNL&trk=api*a4360331*s4423501*</url>
</site-standard-profile-request>
</person>
Hope this will be help you.

Integration Testing of secure Spring Web Service

I am trying to write server side integration tests of my Spring Web Service Endpoint secured using
- Spring WS Security 2.1.2.RELEASE and
- WSS4j 1.6.9.
I am trying to follow Spring documentation http://static.springsource.org/spring-ws/sites/2.0/reference/html/server.html. With the setup that I have got so far, I can send a request payload
<myns:MyRequest xmlns:myns="...">
...
</myns:MyRequest>
using MockWebServiceClient as
mockWebServiceClient.sendRequest(withPayload(requestPayload)).andExpect(clientOrSenderFault());
which the integration test properly maps to the endpoint in the test context and I get a "Could not validate request: No WS-Security header found" error as expected.
Problem: Now the problem here is if I send a request in a SOAP envelope with a security header and body, I would get an endpoint not found exception.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:myns="...">
<soapenv:Header>
...
</soapenv:Header>
<soapenv:Body>
<myns:MyRequest>
...
</myns:MyRequest>
</soapenv:Body>
</soapenv:Envelope>
since it will try to find an endpoint around "{http://schemas.xmlsoap.org/soap/envelope/}Envelope".
Is there a way to work around this problem?
The newer version of Spring WS Test which is 2.1 has two methods added in RequestCreaters: RequestCreators.withSoapEnvelope(Source soapEnvelope) and RequestCreators.withSoapEnvelope(Resource soapEnvelope) which allow sending SOAP envelopes for Integration testing. http://forum.springsource.org/showthread.php?135298-Integration-Testing-of-secure-Spring-Web-Service

Payment Gateway Integration error solving

I have a windows application that requires Payment Gateway Integration.
All these stuff i have done.
The process includes the following...
-Creating Xml Request header
-Encoding it as Url
-send the url encoded data to a Rest API with link being provided in the documentation.
-The test server performs the transaction and sends response back to the application.
What I have done to achieve these functionality...
1) I have used 'HttpWebRequest' class to create request to the URL : I am not going to share it since it security and confidential.
2) I have generated xml header and send it as url encoded.
3) The Server is even responses back to the application. but with Status not success
I am going to post the request formate and response formate.
<?xml version="1.0" encoding="UTF-8"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment">
<merchant-account-id>!#-merchant-account-id-#!</merchant-account-id>
<request-id>!#-request-id-#!</request-id>
<transaction-type>purchase</transaction-type>
<requested-amount currency="AUD">!#-requested-amount-#!</requested-amount>
<account-holder>
<first-name>!#-first-name-#!</first-name>
<last-name>!#-last-name-#!</last-name>
<email>!#-email-#!</email>
<phone>!#-phone-#!</phone>
<address>
<street1>!#-street1-#!</street1>
<street2>!#-street2-#!</street2>
<city>!#-city-#!</city>
<state>!#-state-#!</state>
<country>!#-country-#!</country>
<postal-code>!#-postal-code-#!</postal-code>
</address>
</account-holder>
<card>
<account-number>!#-account-number-#!</account-number>
<expiration-month>!#-expiration-month-#!</expiration-month>
<expiration-year>!#-expiration-year-#!</expiration-year>
<card-type>!#-card-type-#!</card-type>
<card-security-code>!#-card-security-code-#!</card-security-code>
</card>
<notifications>
<notification url="!#-notification-url-#!" transaction-state="failed" />
<notification url="!#-notification-mail-#!" />
</notifications>
<custom-fields>
<custom-field field-name="order no" field-value="!#-order no-#!" />
</custom-fields>
<ip-address>!#-ip-address-#!</ip-address>
</payment>
The following is the response coming back from the server.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment" self="http://sandbox-engine.thesolution.com/engine/rest/merchants/null/payments/null">
<merchant-account-id ref="http://sandbox-engine.thesolution.com/engine/rest/config/merchants/null"/>
<transaction-state>failed</transaction-state>
<completion-time-stamp>2012-11-28T08:19:31.024Z</completion-time-stamp>
<statuses>
<status code="400.1018" description="The same Request Id for the Merchant Account is being tried a second time. Please use another Request Id. " severity="error"/>
<status code="400.1009" description="The Transaction Type is invalid. Please check your input and try again." severity="error"/>
</statuses>
<requested-amount/>
<api-id>elastic-api</api-id>
</payment>
I have cross checked twice with the request header,Each time i do have unique Request id which is 'hiren-'+GUID+DATETIMEWITHTIME
I even have cross checked with the documentation of the gateway for the transaction-type and it's valid but even then it's giving the same error.
To encode url i have used the following code
string sendString = "param=" + HttpUtility.UrlEncode(xmlData);
I'm thinking that the above code may be having the error but it's giving reply back...
so need help to solve the problem.
Please don't ask for the document file but you can ask for extra information.

Resources