Call Web Service via a Java Application and analyze the response
I have currently developed a service web (http://nycews.datajump.com/ATMUtilities.asmx/GetReverseGeoCode?Lat=42.9790550&Lng=-78.7856140) as returnes an address in xml format. I need to know what is the best way to call this connection and parse the XML to display the address to the user in a popupscreen.
Here is a corrected version...
public String getAddress() { String myString = "My String"; byte[] postData = myString.getBytes(); String myAddress = null; // address to return HttpConnection httpConnection; DataOutputStream os; Document doc; String myURLString = "http://www.google.com;interface=wifi"; // use a connection method here try { httpConnection = (HttpConnection) Connector.open(myURLString); httpConnection.setRequestMethod(HttpConnection.POST); httpConnection.setRequestProperty(HttpProtocolConstants.HEADER_CONTENT_TYPE, "application / requestJson"); os = httpConnection.openDataOutputStream(); os.write(postData); int rc = httpConnection.getResponseCode(); if (rc != HttpConnection.HTTP_OK) { return ""; } httpConnection.getResponseCode(); // The following code was taken from http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800599/How_To_... DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory. newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); docBuilder.isValidating(); doc = docBuilder.parse(httpConnection.openDataInputStream()); doc.getDocumentElement ().normalize (); NodeList list=doc.getElementsByTagName("*"); String _node = new String(""); Node tempNode = null; //this "for" loop is used to parse through the //XML document and extract all elements and their //value, so they can be displayed on the device for (int i=0;i
Tags: BlackBerry Developers
Similar Questions
German characters problem when calling Web Services via UTL_HTTP
Dear members,
I try to call the services of SAP CRM Web of Oracle PL/SQL. I used following code which works very well.
However, if there are any German character in SAP, then they are replaced by UNWANTED data when they come to Oracle.-- call web service using Oracle UTIL_HTTP packages DECLARE http_req utl_http.req; http_resp utl_http.resp; lv_request VARCHAR2(32767); lc_response CLOB; lv_buffer VARCHAR2(32000); lv_name VARCHAR2(256); lv_hdr_value VARCHAR2(1024); l_xml XMLType; BEGIN utl_http.set_persistent_conn_support(true); utl_http.set_transfer_timeout(600); http_req:= utl_http.begin_request ( url => 'http://xyz3ni92.server.xyz.com:8045/sap/bc/srt/xip/sap/crm_bupa_custid_qr/011/customersbycrmid/http_binding' , method => 'POST' ); lv_request := '<?xml version="1.0" encoding="UTF-8"?>' ||'<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:glob="http://sap.com/xi/CRM/Global2">' ||'<soap:Header/>' ||'<soap:Body>' ||'<glob:CustomerCRMByIDQuery>' ||'<MessageHeader>' ||'<ID schemeID="?" schemeAgencyID="?" schemeAgencySchemeAgencyID="?"></ID>' ||'<UUID></UUID>' ||'<ReferenceID schemeID="?" schemeAgencyID="?" schemeAgencySchemeAgencyID="?"></ReferenceID>' ||'<ReferenceUUID></ReferenceUUID>' ||'</MessageHeader>' ||'<BusinessPartnerSelectionByBusinessPartner>' ||'<UUID schemeID="?" schemeAgencyID="?"></UUID>' ||'<InternalID>2200117598</InternalID>' ||'</BusinessPartnerSelectionByBusinessPartner>' ||'</glob:CustomerCRMByIDQuery>' ||'</soap:Body>' ||'</soap:Envelope>'; /*set username and password*/ utl_http.set_authentication ( r => http_req, username => 'WS_USER', password => 'WS_PASSWORD', scheme => 'Basic', for_proxy => false); utl_http.set_header(http_req, 'Content-Type', 'application/soap+xml;charset=UTF-8'); utl_http.set_header(http_req, 'Content-Length', LENGTHB(lv_request)); utl_http.write_text(http_req, lv_request); /*Make HTTP call*/ http_resp:= utl_http.get_response(http_req); /*read response text from response*/ BEGIN LOOP utl_http.read_text(http_resp, lv_buffer); lc_response := lc_response || TO_CLOB(lv_buffer); END LOOP; EXCEPTION WHEN OTHERS THEN -- ora-29266 end-of-body reached IF SQLCODE <> -29266 THEN RAISE; END IF; END; utl_http.end_response(http_resp); l_xml := XMLType(lc_response); /*Log response for testing*/ DELETE FROM webservice_log; INSERT INTO webservice_log (seq_id,xml_response) VALUES (sqe_Webservice_Log.NEXTVAL,l_xml); EXCEPTION WHEN OTHERS THEN RAISE; END;
If I invoke continues the same web service tools like SOAP-UI, then German characters do very well. I've also drawn web service queries and answers of the side SAP, and there response shows fine. When it comes to Oracle, they are themselves corrupt.
I'm sure it's something to do with the character, but I am not able to find where and what should I fix/change.
Thank you for your help in advance.
DB: Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
NLS_DATABASE_PARAMETERSKind regardsPARAMETER VALUE ------------------------------ ---------------------------------------- NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CHARACTERSET AL32UTF8 NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE AMERICAN NLS_SORT BINARY NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY $ NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_RDBMS_VERSION 11.2.0.1.0
Hari
added other details by: Hari_639 on April 24, 2013 18:45I'm not really experienced with utl_http, but maybe you'll read on SET_BODY_CHARSET in the documentation.
ISO-8859-1 is the default characterset, until you specify the characters in the attribute content_type and text media.
But your media type is not text, then perhaps affecting the body charset UTF - 8 can help.concerning
BlackBerry, call web services via the SSL protocol
Hi guys,.
We are developing an application BlackBerry to OS 4.1 and we test it on the 8330. This application calls several web services on a remote server via the SSL Protocol (side). There is a valid certificate from Entrust installed on the remote server - it works properly with all major desktop browsers. The certificate has not been installed on the BES - is it necessary? Some BlackBerry devices will be linked to a company BES, others not.
When the application calls the web service, a window opens with the following message: "you try to open a secure connection, but the server certificate is not approved." Continue to push works fine, but the window opens again a few moments later. Pushing view certificate indicates that the certificate is considered invalid ('unverifiable Cert chain'). The same information is given when you navigate to the certificates of the aircraft. Certificate trust pushing watch a 2nd window asking you the key Store password, which we are not aware of.
You guys can help us with this?
Thank you!
We have solved the problem. It seems that the BlackBerry device is having a hard time with a certificate signed by the Entrust 2048 bit root certificate. Give us a new intermediate certificate signed by their 1024-bit root certificate, which we have installed on our Apache server. While the window 'certificate is not approved' arises at once, pushing "Continue" worked and it never came up again. To do this, it will probably install the certificate on the BES, something we don't have yet.
Thank you for taking the time to answer!
ADF Mobile | call web service from Java. non-reflecting values in the AMX page
Hi all
I am using JDEv11124 with ADF Mobile extensions39.62.64.
My use case is as follows.
1. my application has 2 Pages a. Login home b.
2. in the user login Page between user name and click on the "submit" button.
3. on the homepage I displayed the company they joined.
4. in the "submit" button is clicked, action defined in the support bean method will be called.
5. by supporting the action bean method, I'll call the method of the Web Service to validate the entered user name, if the entered user name is valid, that I have to post its company name in the home page.
6. I am moving back from the web service of datacontrol in Home.amx page
7. calling web services from Java as follows:
GenericType = result
(GenericType) AdfmfJavaUtilities.invokeDataControlMethod ("Comp", null, "getCompany",
pNames, params,
PTypes);
System.out.println ("after the call to the service" + result.getAttributeCount ());
8. in the Java class, I get the response correctly (as the company designating the username entered as 'SOCIETY'), where when I navigate to the home page, I don't see any results for the method return (name of the company that dropped like OutputText in Home.amx)
Did I miss something for this. or something more that I need to do to make it work?
Please suggest.
Thank you
Vieira
Hi all
I was able to achieve this by executing my method in bean support.
This code is as follows:
AdfELContext adfELContext = AdfmfJavaUtilities.getAdfELContext ();
MethodExpression me =.
() AdfmfJavaUtilities.getMethodExpression
"#{bindings.retreiveLocationInformation.execute}".
(, Object.class, Class [] {}) new;
me. Invoke (adfELContext, new Object [] {});
Thanks to Luc Bors WebLog Luc Bors Weblog: ADF Mobile: implementation of "Pull to refresh" model
Kind regards
Vieira
Hello world! I'm new to "VMware vSphere API", and I have a question to ask you to help:
What is the difference between "vShpere SDK ro Perl"and "vSphere Web Services SDK (for Java or c#)"?
-What are the different programming language? Is there another difference?
I'm looking forward to your reply.
Thank you!
If you are new on the VMware API/SDK, highly recommend you take a look at the following: Getting Started with vSphere SDK - Update for SDK 4.1 release
vSphere SDK for Perl is just one of the many client SDK for vSphere API that is flush with vcenter times and ESX (i) as a standard Web service.
vSphere SDK for Java - SDK Java to vSphere API for Java developers
vSphere SDK for Perl - Perl SDK for vSphere API for Perl developers
vSphere SDK for c# - c# SDK for vSphere API for c# developers
PowerCLI - PowerShell SDK for vSphere API for developers of Powershell
I hope that makes a bit more sense
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware VCP3, 4
VMware VCAP4-DCA
VMware scripts and resources at: http://www.virtuallyghetto.com/
Introduction to the vMA (tips/tricks)
Getting started with vSphere SDK for Perl
VMware Code Central - Scripts/code samples for developers and administrators
If you find this information useful, please give points to "correct" or "useful".
Web Service security settings of 10g and 11g Migration
We will migrate a complete Application of the ADF from 10g to 11g. We got all this work, but the web services. It seems that we learned the work of web services, but the security settings for the web service are very different and I have difficulties to make them work.
For example, we have a customer's web service that has a X 509 certificate for authentication. We use the WSS 1.0 safety and I chose in the Configuration of the customer strategy: "oracle/wss10_x509_token_with_message_protection_client_policy and in 'Select credentials', I use https identification information."
However, I get the following error when I try to use the web service pointing to the customer: Note: I also detached the client and deleted the credentials and get a SIMILAR error.
< javax.xml.ws.soap.SOAPFaultException: WS-Security treat failure: FAULT CODE: InvalidSecurity MESSAGE of ERROR: header missing WS Security in the SOAP message >
< to com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:197) >
< to com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:122) >
< to com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:125) >
< to com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95) >
< to com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:136) >
So any that I have attached a customer or have not a joint, I get the same error. An idea that I am wrong?
Thank you
Okay, figured it out. I had to use ClientConstants to set the web strategy and set the OWSM political Director to use the appropriate strategy.
The ClientConstants code is:
SecurityPoliciesFeature = securityFeatures
New SecurityPoliciesFeature (new String() {"oracle/wss10_x509_token"});
In InboundOutbound_Service = new InboundOutbound_Service();
InboundOutbound svc = in.getInboundOutboundPort (securityFeatures);
String urlLn = this.getURL ('url');
BindingProvider bp = svc (BindingProvider);
Card
reqContext = bp.getRequestContext ();
reqContext.put (BindingProvider.ENDPOINT_ADDRESS_PROPERTY, urlLn);
reqContext.put (ClientConstants.WSSEC_KEYSTORE_TYPE, "JKS");
reqContext.put (ClientConstants.WSSEC_KEYSTORE_LOCATION, "web.jks");
reqContext.put (ClientConstants.WSSEC_KEYSTORE_PASSWORD, "pw");
reqContext.put (ClientConstants.WSSEC_ENC_KEY_ALIAS, "keyalias");
reqContext.put (ClientConstants.WSSEC_ENC_KEY_PASSWORD, "pw");
reqContext.put (ClientConstants.WSSEC_SIG_KEY_ALIAS, "keyalias");
reqContext.put (ClientConstants.WSSEC_SIG_KEY_PASSWORD, "pw");
reqContext.put (ClientConstants.WSSEC_RECIPIENT_KEY_ALIAS, "serveralias");
Here is a picture of link at all that I found useful:
https://blogs.Oracle.com/OWSM/entry/owsm_concepts_11g
http://docs.Oracle.com/CD/E21764_01/Web.1111/b32511/setup_config.htm#BABJHIBI
Using Oracle Web Service security policies
Review of the architecture of Oracle WSM in Oracle Fusion Middleware
Error object VO when calling Web Service.
Hello
I created a page with 5 field lookup with three buttons and text.
The features are:
1. as the page loads I call Web Service to set the values in the fields.
2. when the user is entering new values or changed the old values and click on the 'save' button, new web service is called for that store values.
Problem is when changing the value of choice of message. For the choice of the message that I created a VO lookup_code and sense.
When I click on 'save' button it shows me errorKind regardsAttribute set for LookupCode in view object EncryptionModeVO1 failed
AjayWell, you use certain methods (like setattributevalue, setrendered etc.) in processformrequest that goes against the standards. You must use SPEL approach wherever possible.
You can hide the exception of developer mode. See thread Re: OAF: masking errors and Exceptions at the top of page OFA for details, but keep in mind that these errors may be valid in some cases.
Thank you
ShreePlease give me exactly code snippet for calling Web services.
Welcome on the support forums.
You can find some samples using the search tool.
There is no 'exact snippet", just a few general samples using ksoap2 or heels.Access Web Service via POST - missing parameter
I'm trying to access web services using the Http Post method, but I'm System.InvalidOperationExeption: missing parameter: ID
error.
I can access the Web service using HTTP GET, which shows that there is nothing wrong with the Web Service itself successfully.
Here is the code I am trying
String retVal = ""; try { String data = "id='25'"; // parameter of the method URLEncodedPostData encodedData = new URLEncodedPostData(null,false); encodedData.append("content", data); byte[] postData = encodedData.getBytes(); HttpConnection connection = (HttpConnection)Connector.open("http://localhost/Service1.asmx/TestService1"); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", Integer.toString(postData.length)); OutputStream requestOutput = connection.openOutputStream(); requestOutput.write(postData); requestOutput.close(); int responseCode = connection.getResponseCode(); String contentType = connection.getHeaderField("Connect-type"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream responseData = connection.openInputStream(); byte[] buffer = new byte[1000]; int bytesRead = responseData.read(buffer); while(bytesRead >0) { baos.write(buffer,0,bytesRead); bytesRead = responseData.read(buffer); } baos.close(); connection.close(); return baos.toString(); } catch (IOException e) { return "ERROR: " + e.getMessage(); }The line in the "BOLD" throws an exception. HTTP response code I get from server is 500
Any help would be much appreciated.
Nitin
Now, I found the solution.
The problem was the URLEncodedPostData. If I use just string.getbyte (), it works.
How to connect to an Adobe Javascript(Folder Level Script) SAP Web Service and retrieve the response in a table of the Adobe Javascript/AcroJS. Could you please it explain with an example. I have two required input parameters that must be filled.
I s generic SOAP example/tutorial on my blog: get a serial number in a form using SOAP - KHKonsulting LLC
The web service uses only a single parameter, but you should be able to adapt the code to two arguments without problems.
Windows media player does not automatically open a video file on a Web site but I save it and open the file with Windows media player to play the video or audio recording. I used to be able to play any video or audio file in any site!
Hello
Try resetting the default associations for WMP and IE.
How to set default Associations for a program under Vista
http://www.Vistax64.com/tutorials/83196-default-programs-program-default-associations.html
How to associate a file Type of Extension to a program under Vista
http://www.Vistax64.com/tutorials/69758-default-programs.htmlIf necessary:
How Unassociate a Type of Extension file in Vista - and a utility to help
http://www.Vistax64.com/tutorials/91920-unassociate-file-extention-type.html
Restore the Type Associations by default Vista file extensions
http://www.Vistax64.com/tutorials/233243-default-file-type-associations-restore.html
How to view and change an Extension of filename on Vista
http://www.Vistax64.com/tutorials/103171-file-name-extension.html====================================
Also follow these steps:
Follow these steps to remove corruption and missing/damaged file system repair or replacement.
Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup
Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN
sfc/scannow
How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
generates in Windows Vista cbs.log
http://support.Microsoft.com/kb/928228Then, run checkdisk - schedule it to run at next boot, then apply OK your way out, then restart.
How to run the check disk at startup in Vista
http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html------------------------------------------------------------
Then, if necessary:
Have you recently installed another player?
Reset your associations for WMP and IE.
How to set default Associations for a program under Vista
http://www.Vistax64.com/tutorials/83196-default-programs-program-default-associations.html
How to associate a file Type of Extension to a program under Vista
http://www.Vistax64.com/tutorials/69758-default-programs.html---------------------------------------------
Do this to reregister the Jscript.dll and Vbscript.dll files.
Start - type in the search box - find command top - RIGHT CLICK – RUN AS ADMIN
type or copy and paste-> regsvr32 jscript.dll
Press entertype or copy and paste-> regsvr32 vbscript.dll
Press enterRestart and if all goes well, it will run now.
--------------------------------------------------------------
Have you recently added stores or ANY application from Stardock?
Using 64-bit Vista?
Can you think of recent things you did in WMP which could be the cause? You added another
reader recently or an add-on for WMP?When I try to use Windows Media Player 11, the program does not start, or some UI elements
are empty - a Mr Fixit
http://support.Microsoft.com/kb/925704/en-usMaybe something here
http://msmvps.com/blogs/chrisl/articles/17315.aspx
and here
http://msmvps.com/blogs/chrisl/Archive/2004/10/30/17399.aspx
Check here the news of WMP11
http://zachd.com/PSS/PSS.htmlI hope this helps.
I hope this helps.
Rob - bicycle - Mark Twain said it is good.
What is the difference in the alta application and extend the alta?
Mr President.
What is the difference in the alta application and extend the alta?
Concerning
Alta application means - you change your application to alta and using only Alta Skin default skin
While Extending means that you use your own skin (custom CSS file) that extends alta means you use alta, but you changed it for some components
Ashish
How to call web services from other applications of E9?
We have an obligation to look to the top of the account ID of a master data management application (no SFDC). The purpose of doing so is to find the account associated with a perspective on the basis of the corporate name, address, city, State, country... The application can expose a web service in search of account. I can call the web service of E9?
Not directly. A solution using Eloqua would create a cloud connector, but the code that connects to Eloqua and other web service live outside these two systems.
Another approach, I recommend if you use Salesforce and the lead will do, there would be screaming to the webservice from Salesforce and have the info power back to Eloqua through integration of eloqua/crm normal.
Time-out period of application that is often when calling web services
My request of phonegap webworks get transaction timeout error often. I create a cross-domain application that invokes the webservice to different places through soap and rest services. I assign the 60000ms as a transaction timeout period. Same application I use in the iPhone and android, I get no transaction timeout instead, I get correct answer. What happens when I load the app into the unit. Even it is not reproducible.
It happened due to
blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK, function() { page_back(); return false; });I was controlling the back through the above code while connection, this memory leak cause. I just removed from the function of connection and stored in the document.ready. Now timeout is not the case but I am facing app closes at the launch of the application.
Access a secure web service of ADF Mobile Application
Hello
We try to create an ADF Mobile application that uses a secure web service located in Oracle EBS (with SOA Suite).
We use JDeveloper 11 g 11.1.2.4.0
Initially, create usd a Control(SOAP/REST) Gallery Web Service data and provided the WSDL document. We tried to run on a simulator, but not did not do anything. We have also found a way to provide the user name and password. So we left it there.
Then we tried to create a Java desktop app to check if it was a problem with our server. In the desktop application, we created a "Web Service Client and Proxy" new gallery followed the steps and used oracle/wss_username_token_client_policy, added the code below to put the username and password and was able to call the service and retrieve data.
(reqContext.put (BindingProvider.USERNAME_PROPERTY, "DBAKER");
reqContext.put (BindingProvider.PASSWORD_PROPERTY, "xxxxx");
So we thought to return to the application the ADF Mobile and creating a "Web Service Client and Proxy" it, but when we built this project, we had the ' annotations are not supported in - source 1.4 "&" generics are not supported in - source 1.4 "errors and found that ADF Mobile does not support beyond Java 1.4" "» (Is that right?)
We then found the video "to access the secure Services of ADF Mobile Web" by Shay (https://www.youtube.com/watch?v=rk5om3o3Pas) and saw that he was using a login server.
We wanted to confirm if you use a login server is the right path to access a secure web service of an Oracle ADF Mobile application?
Are there other ways to do it?
If we need to create a login server, can provide you links that will put us on the right track in establishing a connection server that can connect to the EBS?
Thank you.
The URL must point to a protected page that prompts the user for basic authentication.
See an example here:
https://blogs.Oracle.com/Shay/entry/accessing_secure_web_services_from
As well as the blogs linked at the bottom of this entry.
Maybe you are looking for
-
My apps are not for download. It just says: wait.
I was not able to download apps for the whole day. No error indicates just on hold.
-
HP Pavilion Notebook 15-e078sa: could not load the Driver USB controller
Hi, I'm unable to find the driver for my USB controller, can anyone help?
-
Pavilion laptop - 15-ab262nr: HP 3D DriveGuard and Coolsense software does not install
Reinstalled Windows 10 on this PC laptop shortly after purchase (clean install to remove all the bloating) and Software HP Coolsense and DriveGuard will not install. After having downloaded DriveGuard and try to run the installer, nothing happens, so
-
editing text in a string indicator
I use a slide switch to set either AM or PM on my front. How can I use an indicator of string and the text in the change of the indicator from am to PM that the position was on my slide switch?
-
Good evening - y at - it an easy way to do A / B testing? I can see a few strings here in 2011, but not like not there is no recent data. It is recommended A / B test in E10, but I'm not too familiar with the program generator, so I'm not sure how