Tuesday, October 3, 2017

WebService TitBit- 1

Difference between SOAP 1.1 and 1.2 

SOAP 1.1 technically allows XML elements
to occur after the SOAP body. In SOAP 1.2, by contrast, the SOAP body is the last XML
element in the SOAP envelope.

The 1.1 version binds SOAP
to HTTP transport, whereas the 1.2 version also supports SOAP over SMTP.

Thursday, September 14, 2017

Common terms in Web services

JAXB - API for XML Binding
JAXP - API for XML Processing
JAXM - API for XML Messaging
JAXR - API for XML Registries
JAX RPC - API for XML Remote Procedure Call
JAX TX - API for XML Transactions
JAAS- Java Authentication and Authorization Services 
JAF - Java Beans Activation Framework
JNDI- Java Native and Directory Interface
UDDI - Universal Description and Discovery Integration
WSDL - Web Service Description Language 
SOAP - Simple Object Access  Protocol
JSON - Java Script Object Notation
SAAJ- SOAP with Attachments for Java.


JAX WS ( API ) ( Metro = implementation ) ( requires WSDL ) 
JAX RS ( API ) ( Jersey = implementation ) 

Web service concept was developed to  remove short comings of  EJB .
An EJB can be also be deployed as  Web Service .

Since Java 1.6, there's a built-in HTTP server included with the JDK.
The HttpServer provides a simple high-level Http server API, which can be used to build embedded HTTP servers.
Endpoint.publish  accepts requests from a webservice  at a port at the same HTTP server .
for more into check out 

Thursday, August 24, 2017

Long Data types in DB

The use of LONG values is subject to these restrictions:
  • A table can contain only one LONG column.
  • You cannot create an object type with a LONG attribute.
  • LONG columns cannot appear in WHERE clauses or in integrity constraints (except that they can appear in NULL and NOT NULL constraints).
  • LONG columns cannot be indexed.
  • LONG data cannot be specified in regular expressions.
  • A stored function cannot return a LONG value.
  • You can declare a variable or argument of a PL/SQL program unit using the LONG data type. However, you cannot then call the program unit from SQL.
  • Within a single SQL statement, all LONG columns, updated tables, and locked tables must be located on the same database.
  • LONG and LONG RAW columns cannot be used in distributed SQL statements and cannot be replicated.
  • If a table has both LONG and LOB columns, then you cannot bind more than 4000 bytes of data to both the LONG and LOB columns in the same SQL statement. However, you can bind more than 4000 bytes of data to either the LONG or the LOB column.
In addition, LONG columns cannot appear in these parts of SQL statements:
  • GROUP BY clauses, ORDER BY clauses, or CONNECT BY clauses or with the DISTINCT operator in SELECT statements
  • The UNIQUE operator of a SELECT statement
  • The column list of a CREATE CLUSTER statement
  • The CLUSTER clause of a CREATE MATERIALIZED VIEW statement
  • SQL built-in functions, expressions, or conditions
  • SELECT lists of queries containing GROUP BY clauses
  • SELECT lists of subqueries or queries combined by the UNION, INTERSECT, or MINUS set operators
  • SELECT lists of CREATE TABLE ... AS SELECT statements
  • ALTER TABLE ... MOVE statements
  • SELECT lists in subqueries in INSERT statements



Tuesday, August 22, 2017

Difference between trustStore and keyStore

TrustManager determines whether remote connection should be trusted or not

·         trustStore is for client  to validate the  authenticity of  web server .
·         It holds public key provided by the web server . 
·         trustStore is used by TrustManager in Java
·         -Djavax.net.ssl.trustStore to specify path for trustStore in Java.




keystore decides which  authentication credentials should be sent to the remote host for authentication during SSL handshake

·         It hold the private key used by Web server to encrypt the messages send to Clients.
·         keyStore is used by keyManager in java.
·         -Djavax.net.ssl.keyStore is path to specify keystore in Java



Tuesday, July 11, 2017

how to download source of app hosted on Google cloud

Fire below cmd 

appcfg.sh -A janews-151415 -V 1 download_app "C:/Temp"

Monday, November 28, 2016

Quick cmd to POST data to remote server over HTTP in Powershell


--------------------------------------------------------------------------
create a file  named test.ps1

write below cmds 
body=@"< a >name< / a>< b>password< / b>"@

 $URL = "http://www.computerperformance.co.uk"

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", 'text/xml')
$headers.Add("SOAPAction", '')
$response
 = Invoke-WebRequest -Uri $Url -Body $body -Headers $headers -Method POST


$reponse.StatusCode

Run the script with FQDN

&; "C:\Scripts\test.ps1"


----

$response = Invoke-WebRequest -Uri "http://somesite.com/oneendpoint" -Method Post -Body $JSON -ContentType "text/xml"
$uri = 'https://www.myWebsite.com/ext/ext/ext'
$data = Get-Content "kronos_ping.xml"
$result = Invoke-WebRequest -Uri $uri -Body $data -ContentType 'text/xml' -Method POST


$result.RawContent
----

Tuesday, August 9, 2016

Design Pattern - SingleTon

SingleTon class must be threadsafe , must produce only single instance per application per JVM. ENUM are immutable constants and hence  very easy to use for SingleTon class.


Method Injection  in Spring  IOC 


  < bean id="claimServiceManager" class="com.hp.eclaims.service.manager.ClaimServiceManager" > < property name="claimServiceDao" ref="claimServiceDao" /> < property name="claimServiceUtil" ref="claimServiceUtil" /> < lookup-method name="createNewTaskExecutor" bean="taskExecutor" /> < lookup-method name="createNewTask" bean="tasks" />
</ bean >
                 < bean id="tasks" class="com.hp.eclaims.service.util.ServiceTasks" scope="prototype">
                 < bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor" scope="prototype" init-method="initialize" destroy-method="shutdown">


Above example shows how spring IOC achieves method injection (DI) .
Every time new objects of taskexecutor and tasks will get instantiated and passed into ClaimServiceManager thorugh abstract method createNewTaskExecutor and createNewTask . Those two are defined as  prototype scope in DD .

It is  helpful in  passing  prototype  scope object to singleton object type .