InputStream- String
Hey fellows,
i have an InputStream and I want to read in the data from the stream into a string. How do I do that?
Thanks
this is how you do it if youre using sockets btw
ObjectInputStream in = new ObjectInputStream(yoursocket.getInputStream());
receivedString = (String)in.readObject();
hope this helps
Similar Messages
-
Question about reading a string or integer at the command line.
Now I know java doesn't have something like scanf/readln buillt into it, but I was wondering what's the easiest, and what's the most robust way to add this functionality? (This may require two separate answers, sorry).
The reason I ask is because I've been learning java via self study for the SCJA, and last night was the first time I ever attempted to do this and it was just hellish. I was trying to make a simple guessing game at the command line, I didn't realize there wasn't a command read keyboard input.
After fighting with the code for an hour trying to figure it out, I finally got it to read the line via a buffered reader and InputStreamReader(System.in), and ran a try block that threw an exception. Then I just used parseInt to get the integer value for the guess.
Another question: To take command line input, do you have to throw an exception? And is there an easier way to make this work? It seems awfully complicated to take user input without a jframe and calling swing.
Edited by: JGannon on Nov 1, 2007 2:09 PM1. Does scanner still work in JDK1.6?Try it and see. (Hint: the 1.6 documentation for the class says "Since: 1.5")
If you get behaviour that doesn't fit with what you expect it to do, post your code and a description of our expectations.
2. Are scanner and console essentially the same thing?No.
Scanner is a class that provides methods to break up its input into pieces and return them as strings and primitive values. The input can be a variety of things: File InputStream, String etc (see the Scanner constructor documentation). The emphasis is on the scanning methods, not the input source.
Console, on the other hand, is for working with ... the console. What the "console" is (and whether it is anything) depends on the JVM. It doesn't provide a lot of functionality (although the "masked" password input can't be obtained easily any other way). In terms of your task it will provide a reader associated with the console from which you can create a BufferedReader and proceed as you are at the moment. The emphasis with this class is the particular input source (and output destination), not the scanning.
http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
http://java.sun.com/javase/6/docs/api/java/io/Console.html -
Error while trying to retrieve string from STDIN
Hello,
I want to read a string from input I use this code but getting compilation error:
String s = System.in.readLine();
Error is:
symbol : method readLine ()
location: class java.io.InputStream
String s=System.in.readLine();
^
1 error
what's going wrong?
System is Linux Slackware 9.1
Thanks,
Regards.Yeah, don't use readLine if you just want a single character. Actually you don't need the BufferedReader at all unless you want to do buffering for a reasoon other than to make it easy to read a line at a time. (Of course, buffering is a good thing anyway, but it's not strictly relevant to grabbing a character.)
Re: requiring enter to be pressed, that may have a lot to do with your shell as well.
try {
Reader in = new InputStreamReader(System.in);
int theChar; // you need an int because the read method returns values
// beyond the bits required for a char, to denote end of file
while((theChar = in.read()) > -1) {
System.out.println("Char read: " + (char) theChar);
System.out.println("end of file reached");
} catch (IOException e) {
e.printStackTrace();
} -
Hello,
I have an input stream opened for reading. I'd like to dump its content to a file, to disk. Currently I do it "myself" (I wrote code to do it), but I suppose it is possible to do it using the java API with a simple call (probably more efficient and clean than what I use).
My code is the following:
private void dumpToFile(InputStream inputStream, String outputFile)
throws FileNotFoundException, IOException {
File outF = new File(outputFile);
FileOutputStream outS = new FileOutputStream(outF);
int byt;
while ((byt = inputStream.read()) != -1) {
outS.write(byt);
outS.close();
}Thank you for your replies. I'll indeed wrap the streams into buffered streams. I simply wanted to know if there was a simpler way to do that (strange that it does not exist in this so dense java io API).
Thank you,
Olivier -
Parse XML in inputstream, help!
From a socket, I get a XML from the inputstream, in the XML it has many tages called "City", I want to take all the Citys out and put them in an array, there is something with my code, who can fix it?
import java.io.*;
import java.net.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
public class TCPClient {
public static void main(String argv[])throws Exception {
final int HTTP_PORT=80;
Socket socket1 = new Socket("www.webservicex.net", HTTP_PORT);
BufferedWriter out= new BufferedWriter(new OutputStreamWriter(socket1.getOutputStream(), "UTF8"));
// BufferedReader in= new BufferedReader(new InputStreamReader(socket1.getInputStream()));
out.write("POST http://www.webservicex.net/globalweather.asmx/GetCitiesByCountry HTTP/1.0\r\n");
out.write("Host: www.webservicex.net\r\n");
out.write("Content-Type: application/x-www-form-urlencoded\r\n");
String body = "CountryName=china";
out.write("Content-Length: " + body.length() + "\r\n");
out.write("\r\n");
out.write(body);
out.flush();
InputStreamReader inputStream = new InputStreamReader(socket1.getInputStream());
System.out.println("Encoding is " + inputStream.getEncoding());
BufferedReader in = new BufferedReader(inputStream);
String xmlString="";
String line;
while((line=in.readLine())!=null){
xmlString+=line;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(new InputSource(new StringReader(xmlString)));
NodeList nl = document.getElementsByTagName("City");
for (int count = 0; count < nl.getLength(); count++) {
Node n = nl.item(count);
System.out.println(n);
out.close();
in.close();
}There are no "City" elements in the XML. In fact, as with your post yesterday, there is very very little in the XML.
Also, there is no need to create a String of the response. You can use the reader directly to in the InputSource.
Edited by: sabre150 on Aug 11, 2009 1:08 PM -
AT Commands , Hyper Terminal and java
Hi,
I have following problem, i have PCMCIA Type -11 Wireless modem.its installed on my system COM4 port.
Now first problem is that when i try to connect with hyper terminal to COM4 there is no response from it .It become Idle.but when i connect with COM3 which is my Dialup modem port it works fine with all AT commands.
Now 2nd things is that same with below code i tried to send sms using AT command on COM4 its has same behaviour as it was in Hyper terminal mean no response. no Data Available event occour
Please help me in this regard and suggest me a solution.
package serialio;
import javax.comm.*;
import java.io.*;
import java.util.*;
public class SimpleWrite
implements Runnable, SerialPortEventListener
public void run()
static Enumeration portList;
static CommPortIdentifier portId;
static String dest = "0517111930";
static String messageString = "Hello";
InputStream inputStream;
static SerialPort serialPort;
static OutputStream outputStream;
public void serialEvent(SerialPortEvent event)
switch (event.getEventType())
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = "";
try
while ( (line = reader.readLine()) != null)
System.out.println(line);
catch (IOException e)
System.err.println("Error while reading Port " + e);
break;
} //switch
public SimpleWrite(SerialPort serial)
try
inputStream = serial.getInputStream();
try
serial.addEventListener(this);
catch (TooManyListenersException e)
System.out.println("Exception in Adding Listener" + e);
serial.notifyOnDataAvailable(true);
catch (Exception ex)
System.out.println("Exception in getting InputStream" + ex);
public static void main(String[] args)
// String line1="AT+CMGF=1\r\n";
// String line2="AT+CMGS=\""+ dest+"\"\r\n";
// String line3=messageString+"\r\n";
// String line4="\u001A";
String line1 = "AT+CMGF=1\r\n";
String line2 = "AT+CMGS=" + dest + "\r\n";
String line3 = messageString + "^Z\r\n";
// String line4 = "\u001A";
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements())
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL)
System.out.println("SMS Sending........");
if ( portId.getName().equals("COM4"))
System.out.println("SMS Sending....Port Found");
try
serialPort = (SerialPort) portId.open("SimpleWriteApp", 2000);
SimpleWrite wr = new SimpleWrite(serialPort);
catch (PortInUseException e)
System.out.println("Port In Use " + e);
try
outputStream = serialPort.getOutputStream();
catch (IOException e)
System.out.println("Error writing to output stream " + e);
try
serialPort.setSerialPortParams(
2400,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
catch (UnsupportedCommOperationException e)
try
outputStream.write(line1.getBytes());
outputStream.write(line2.getBytes());
outputStream.write(line3.getBytes());
outputStream.flush();
catch (IOException e)
System.out.println("Error writing message " + e);
/** show text in the text window
* @param Text text string to show on the display
public static void showText(String Text)
System.out.println(Text);
}* SerialWrite.java
* Created on September 10, 2008, 2:51 PM
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package com.sms;
import javax.comm.*;
import java.io.*;
import java.util.*;
public class SerialWrite implements Runnable, SerialPortEventListener
static String output="";
public void run()
static Enumeration portList;
static CommPortIdentifier portId;
static String dest = "+91999999999";
static String messageString = "Hello Testing11";
InputStream inputStream;
static SerialPort serialPort;
static OutputStream outputStream;
public void serialEvent(SerialPortEvent event)
switch (event.getEventType())
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
System.out.println("Error");
break;
case SerialPortEvent.DATA_AVAILABLE:
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = "";
try
while ( (line = reader.readLine()) != null)
if(line.equalsIgnoreCase("OK") || (line.indexOf("+CMGS") != -1))
output=line;
Thread.sleep(10);
catch (Exception e)
System.err.println("Error while reading Port " + e);
break;
} //switch
public SerialWrite(SerialPort serial)
try
inputStream = serial.getInputStream();
try
serial.addEventListener(this);
catch (TooManyListenersException e)
System.out.println("Exception in Adding Listener" + e);
serial.notifyOnDataAvailable(true);
catch (Exception ex)
System.out.println("Exception in getting InputStream" + ex);
public static void main(String[] args) throws Exception
int i=0;
String line0 = "ATZ\r\n";
String line1 = "AT+CMGF=1\r\n";
String line2 = "AT+CSCA=\"+919888888\"\r\n";
//String line3 = "AT+CMGS="+"\""+ dest + "\""+"\r\n";
String line3 = "AT+CMGS="+"\""+ args[0] + "\""+"\r\n";
//String line4 = messageString;
String line4 = args[1];
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements())
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL)
System.out.println("SMS Sending........");
if ( portId.getName().equals("/dev/ttyACM0"))
System.out.println("SMS Sending....Port Found");
try
serialPort = (SerialPort) portId.open("SerialTestApp", 2000);
SerialWrite wr = new SerialWrite(serialPort);
catch (PortInUseException e)
System.out.println("Port In Use " + e);
try
outputStream = serialPort.getOutputStream();
catch (IOException e)
System.out.println("Error writing to output stream " + e);
try
serialPort.setSerialPortParams(
115200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
catch (UnsupportedCommOperationException e)
try
outputStream.write(line0.getBytes());
Thread.sleep(10);
while(!output.equalsIgnoreCase("ok"))
Thread.sleep(10);
output="";
outputStream.write(line1.getBytes());
while(!output.equalsIgnoreCase("ok"))
Thread.sleep(10);
output="";
outputStream.write(line2.getBytes());
while(!output.equalsIgnoreCase("ok"))
Thread.sleep(10);
output="";
for(i=0;i<3;i++)
outputStream.write(line3.getBytes());
Thread.sleep(10);
outputStream.write(line4.getBytes());
Thread.sleep(10);
outputStream.write(26);
outputStream.write("\r\n".getBytes());
outputStream.flush();
while(!output.equalsIgnoreCase("ok"))
Thread.sleep(10);
output="";
System.out.println("Message Sent !!!!!!!!!1");
catch (IOException e)
System.out.println("Error writing message " + e);
/** show text in the text window
* @param Text text string to show on the display
public static void showText(String Text)
System.out.println("TEXT "+Text);
} -
How to get the list of computers connected in LAN
Operating System must be Windows because I am using Windows Server 2003.
I am doing a project in Java Networking to monitor computers in Lan.I went through the API but I didn't get anything.So if possible please give me the code to fetch the IP address of the comps connected in LAN.
Thanks in Advancepublic void getAllIP(){
Process p =null;
//System.out.println(" Ip sads:");
try{
StringBuilder stdOut = new StringBuilder();
Process proc = Runtime.getRuntime().exec( "net view" );
processOutputHandler(proc.getInputStream());
proc.waitFor();
}catch(Exception e){
private void processOutputHandler(InputStream inputStream) {
BufferedReader br = null;
br = new BufferedReader(new InputStreamReader(inputStream));
String sLine = null;
try {
int i=0;
while ( ( sLine = br.readLine() ) != null ) {
sLine = sLine.trim();
System.out.println(sLine);
} catch (Exception ex) {
ex.printStackTrace();
i think this will help u...Good Luck -
Category attributes default values updating
Hi,
I'm developing an application that, upon upload of a file to the specified root folder(through the application), reads some values from a file, creates a folder structure based on those values, and moves the file in the bottom folder. Now, a predefined category should be attached to the file, to enable search by category attributes. My idea is to set the category as required on that bottom folder (or the first), and modify it's attribute default values, so that the file inherits them when moved in it. I have found mshannon's examples in some other thread ( Updating a document with category metadata using updateDocument(): error! ), the first one works only with files, not folders, and the second one doesn't work for me at all, I get an error:
javax.faces.el.EvaluationException: ORACLE.FDK.AggregateError:ORACLE.FDK.AggregateError
here is my code:
public static void updateAttributes() throws FdkException, RemoteException{
login();
FileManager fm = s_WsCon.getFileManager();
Item fajl = fm.resolvePath(prop.getProperty("userhome") + "/root folder/folder1/readme1.txt",
null);
long docID = fajl.getId();
NamedValue[] catInstAtr = new NamedValue[] {
new NamedValue("CUSTOM_138297", "changed value for att1"),
new NamedValue("CUSTOM_138299", "changed value for att2")
NamedValue[] catDef = new NamedValue[] {
new NamedValue(Options.UPDATE_CATEGORY_ID,new Long(139054)),
new NamedValue(Options.CATEGORY_DEFINITION_ATTRIBUTES, catInstAtr)
NamedValue[] docDef = new NamedValue[] {
new NamedValue(Options.CATEGORY_DEFINITION, catDef)
AttributeRequest[] reqAtr = new AttributeRequest[]{
new AttributeRequest(Attributes.DESCRIPTION, null)
fajl = fm.updateDocument(docID, docDef, reqAtr);
logut();
This example is (I think) only for updating on document level, but I could use a solution for folder-level updating, as I explained before. Can anyone help me?
Thanks,
PedjaPedja,
Here is my code to get category from Folder this is updated version from sample code TestCategory2.java
1. It will get the required category of a folder.
2. gets the internal category attribute names
3. get Category id if uploading file along with category attribute values OR
updating file and also updating previous category instance values..
package oracle.ifs.examples.content.testcases;
import java.util.Map;
import java.util.Properties;
import java.util.*;
// Facade Objects
import oracle.ifs.fdk.AttributeRequest;
import oracle.ifs.fdk.Attributes;
import oracle.ifs.fdk.FdkConstants;
import oracle.ifs.fdk.FdkErrorCodes;
import oracle.ifs.fdk.FdkException;
import oracle.ifs.fdk.FdkExceptionEntry;
import oracle.ifs.fdk.Item;
import oracle.ifs.fdk.Options;
import oracle.ifs.fdk.NamedValue;
import oracle.ifs.fdk.NamedValueSet;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import HTTPClient.HTTPConnection;
import HTTPClient.HTTPResponse;
import HTTPClient.HttpOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
// Web Services Managers
import oracle.ifs.fdk.CategoryManager;
import oracle.ifs.fdk.CommonManager;
import oracle.ifs.fdk.FileManager;
// Framework
import oracle.ifs.examples.content.fdk.FdkSession;
import oracle.ifs.examples.content.fdk.FdkUtils;
import oracle.ifs.examples.content.fdk.Managers;
import oracle.ifs.examples.content.fdk.constants.ItemAttributes;
import oracle.ifs.examples.content.fdk.constants.NamedValueConstants;
import oracle.ifs.examples.content.testcases.AbstractTest;
public class TestCategories3
implements ItemAttributes, NamedValueConstants
public TestCategories3()
public static void main(String[] args)
TestCategories3 tc3= new TestCategories3();
tc3.getCatinfo();
* This is where you write your test program.
public void getCatinfo()
log(this.getClass().getName()+": starting");
FdkSession session = null;
try
AttributeRequest[] requestedAttributes = null;
NamedValue[] sortOptions = null;
Map returnedAttrs = null, map = null;
log("\nAuthenticating as regular test user ...");
session = new FdkSession("http://xxx.com:8320/content/","anakkala","sample");
CommonManager commonM = Managers.getCommonManager(session);
CategoryManager categoryM = Managers.getCategoryManager(session);
FileManager fileM = Managers.getFileManager(session);
// save this attribute request so that it can be used later
AttributeRequest[] AR_CATEGORY_CONFIGURATION_ATTRIBUTES =
FdkUtils.newAttributeRequestArray(Attributes.CATEGORY_CONFIGURATION,
FdkUtils.newAttributeRequestArray(new Object[]
// Is the category configuration enabled
FdkUtils.newAttributeRequest(Attributes.CONFIGURATION_ENABLED),
// Can the category configuration be overridden or is it final
FdkUtils.newAttributeRequest(Attributes.CONFIGURATION_FINAL),
// What are the required categories for the category configuration
FdkUtils.newAttributeRequest(Attributes.REQUIRED_CATEGORIES,
// for the required categories ...
FdkUtils.newAttributeRequestArray(new Object[]
// What is the category classobject display name
FdkUtils.newAttributeRequest(Attributes.DISPLAY_NAME),
// get attributes inherited and introduced by category object
FdkUtils.newAttributeRequest(Attributes.METADATA_ATTRIBUTES,
// get full settings for each of these attributes
FdkUtils.newAttributeRequestArray(METADATA_ATTRIBUTE_ATTRIBUTES)
// Are there any attribute overrides for this category config?
FdkUtils.newAttributeRequest(Attributes.ATTRIBUTE_OVERRIDES,
// get full settings for each of these attribute overrides
FdkUtils.newAttributeRequestArray(ATTRIBUTE_OVERRIDE_ATTRIBUTES))
log("\nLooking up folder /d-rco/C1/L1/folder1 ...");
// convert attribute request map to AttributeRequest[]
requestedAttributes = AR_CATEGORY_CONFIGURATION_ATTRIBUTES;
Item folder =fileM.resolvePath(
"/d-rco/C1/L1/folder1",
requestedAttributes);
log("folder id is="+folder.getId());
log("\nProcessing requested attributes - goal: generate override ...");
//returns a map
returnedAttrs = FdkUtils.getAttributesMap(folder);
Item categoryConfig = (Item)
returnedAttrs.get(Attributes.CATEGORY_CONFIGURATION);
returnedAttrs = FdkUtils.getAttributesMap(categoryConfig);
// is CategoryConfiguration enabled?
Boolean ccEnabled = (Boolean) returnedAttrs.
get(Attributes.CONFIGURATION_ENABLED);
// is CategoryConfiguration final? false=subfolders can override
Boolean ccFinal = (Boolean) returnedAttrs.
get(Attributes.CONFIGURATION_FINAL);
// what are the attribute overrides for this category configuration
log("\nAttribute overrides ...");
Item[] attributeOverrides = (Item[]) returnedAttrs.
get(Attributes.ATTRIBUTE_OVERRIDES);
FdkUtils.log(attributeOverrides);
// what are the requred categories for this category configuration
log("\nRequired categories ...");
Item[] reqCategories = (Item[]) returnedAttrs.get(Attributes.REQUIRED_CATEGORIES);
FdkUtils.log(reqCategories);
log("After printing required categories");
if(ccEnabled.booleanValue() && !ccFinal.booleanValue()
&& reqCategories != null && reqCategories.length >= 1)
// Folder /<domain>/<basecontainer>/L1/F3.EC has an enabled category
// configuration that can be overridden and has required categories
// present ...
Item category = null;
for (int i=0; i < reqCategories.length; i++)
returnedAttrs = FdkUtils.getAttributesMap(reqCategories);
log( "xxx name="+((String) returnedAttrs.get(Attributes.DISPLAY_NAME) ));
if ( ((String) returnedAttrs.get(Attributes.DISPLAY_NAME)).
equals("BG_Serv_Req"))
category = reqCategories[i];
break;
log("category id="+category.getId());
if (category != null)
NamedValue[] internalCategoryAttrs = null;
try {
internalCategoryAttrs =getInternalCategoryAttrNames("BG_Serv_Req",session);
}catch(Exception e)
log("error getting internal names");
e.printStackTrace();
log("Category Attribute internal Name ="+ (String)internalCategoryAttrs[0].getValue());
log("Category Attribute internal Name ="+ (String)internalCategoryAttrs[1].getValue());
NamedValue[] categoryInstanceAttributes = new NamedValue[] {
// use the internal attribute name for all attributes
new NamedValue((String)internalCategoryAttrs[0].getValue(), "XNXNXNXN 234"),
new NamedValue((String)internalCategoryAttrs[1].getValue(), "SNKKSKSK 1234")
NamedValue[] categoryDef = new NamedValue[] {
// the id of the category object class for which this new category will be an
//instance of
new NamedValue(Options.CATEGORY_CLASS_ID, new Long(category.getId())),
// the updated values of the category instance
new NamedValue(Options.CATEGORY_DEFINITION_ATTRIBUTES, categoryInstanceAttributes)
String sourceFile="test.doc";
String folderPath = "C:\\upload";
requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
Item doc = fileM.resolveRelativePath(folder.getId(),sourceFile, requestedAttributes);
log("START ORACLE TEST CODE FROM TAR");
// this will get the category instance id
AttributeRequest categoryAR = new AttributeRequest();
categoryAR.setAttributeName(Attributes.CATEGORIES);
AttributeRequest[] attrRequests = new AttributeRequest[]
{ categoryAR};
Item myDoc = commonM.getItem(doc.getId(), attrRequests);
NamedValue[] requestedAttributesNV = myDoc.getRequestedAttributes();
int length = requestedAttributesNV == null ? 0 :
requestedAttributesNV.length;
Item[] itemCategories = null;
log("length="+length);
for (int i = 0; i < length; i++)
log("requestedAttributesNV[i].getName()="+requestedAttributesNV[i].getName());
if(requestedAttributesNV[i].getName().equals(Attributes.CATEGORIES))
itemCategories = (Item[]) requestedAttributesNV[i].getValue();
length = itemCategories == null ? 0 : itemCategories.length;
log("length="+length);
long categoryInstanceId = 0;
for (int i = 0; i < length; i++)
log("Category instance " + itemCategories[i].getName() + " has id " +
itemCategories[i].getId());
categoryInstanceId = itemCategories[i].getId();
log("END ORACLE TEST CODE FROM TAR");
/* If the document does not exist in OCS */
if (doc == null) {
requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
NamedValue[] nvdoc = FdkUtils.newNamedValueArray(
new Object[][] { { Attributes.NAME,sourceFile} }
Item def = fileM.createDocumentDefinition(nvdoc,requestedAttributes);
int uploadStatusCode = uploadContent(
session,
getSampleFileStream(sourceFile,folderPath),
(String) FdkUtils.getAttribute(def,Attributes.URL)
log("Upload Status to definition file: "+uploadStatusCode);
nvdoc = FdkUtils.newNamedValueArray(
new Object[][]
{ Attributes.NAME,sourceFile},
{ Options.USE_SAVED_DEFINITION, new Long(def.getId())},
{ Options.DESTFOLDER, new Long(folder.getId()) },
// apply category instance informationnew
{ Options.CATEGORY_DEFINITION, categoryDef }
requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
doc = fileM.createDocument(nvdoc,null,requestedAttributes);
}else /* if document already exist in OCS */
log(sourceFile+" file exists so updating ...");
int uploadStatusCode = uploadContent(
session,
getSampleFileStream(sourceFile,folderPath),
(String) FdkUtils.getAttribute(doc ,Attributes.URL)
log("uploadStatusCode="+uploadStatusCode);
FileInputStream fi= getSampleFileStream(sourceFile,folderPath);
log("category id using in update="+ category.getId());
NamedValue[] updatecatdef = new NamedValue[] {
//new NamedValue(Options.UPDATE_CATEGORY_ID, new Long(category.getId())),
new NamedValue(Options.UPDATE_CATEGORY_ID, new Long(categoryInstanceId)),
new NamedValue(Options.CATEGORY_DEFINITION_ATTRIBUTES,
new NamedValue[] {
new NamedValue((String)internalCategoryAttrs[0].getValue(), "AH234 V2"),
new NamedValue((String)internalCategoryAttrs[1].getValue(), "SNHGZ12 V2")
NamedValue[] nv = FdkUtils.newNamedValueArray(
new Object[][]
{ Attributes.NAME,sourceFile},
{ Attributes.DESCRIPTION,"Sample file"},
//{Options.CONTENTSTREAM, fi},
{ Options.CATEGORY_DEFINITION, updatecatdef }//Newly added for category upload
requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
// THIS IS WHERE WE ARE GETTING ERROR
fileM.updateDocument(doc.getId(),nv,requestedAttributes);
System.out.println("doc = fm.updateDocument is complete ........." );
} // end if (Document Confidentiality category present)
} // end if category configuration enabled / overridable etc
catch (FdkException fe)
FdkUtils.log(fe);
fe.printStackTrace();
catch (Exception e)
// java.net.MalformedURLException;
// java.rmi.RemoteException;
// javax.xml.rpc.ServiceException;
// org.apache.axis.AxisFault
log("Fatal exception occurred in run():");
e.printStackTrace();
finally
if (session != null)
session.disconnect();
log("\n"+this.getClass().getName()+": ending");
private FileInputStream getSampleFileStream(String filename,String path)
throws FileNotFoundException
FileInputStream stream = null;
if (filename != null && filename.length() >= 1)
if (path.length() >=1 && !path.endsWith("/"))
path += "/";
stream = new FileInputStream(new File(path+filename));
return stream;
public int uploadContent(
FdkSession session,
InputStream inputStream,
String destinationURL
throws Exception
int statusCode = -1;
if (inputStream == null) return statusCode;
HTTPConnection conn = null;
try
URL url = new URL(destinationURL);
conn = session.getHttpConnection(url);
byte[] buffer = new byte[8192];
int count=0;
HttpOutputStream outputStream = new HttpOutputStream();
HTTPResponse response = conn.Put(url.getFile(), outputStream);
try
while ((count = inputStream.read(buffer)) != -1)
outputStream.write(buffer, 0, count);
finally
outputStream.flush();
outputStream.close();
statusCode = response.getStatusCode();
finally
if (inputStream != null)
inputStream.close();
if (conn != null)
conn.stop();
conn = null;
return statusCode;
// Handle the response. Note that a successful response may not be
// 200, but may also be 201 Created, 204 No Content or any of the other
// 2xx range responses.
public void log(String s)
System.out.println(s);
public NamedValue[] getInternalCategoryAttrNames(String categoryName,FdkSession session) throws Exception
NamedValue[] returnNV = null;
Map attmap = new HashMap();
attmap.put(Attributes.METADATA_ATTRIBUTES,
FdkUtils.newAttributeRequestArray(
new String[] { Attributes.ATTRIBUTE_NAME,
Attributes.DISPLAY_NAME }));
AttributeRequest[] request = FdkUtils.getAttributeRequestArray(attmap);
Item cat = FdkUtils.getCategoryObject(session, null, categoryName, request);
log("inside method cat id="+cat.getId());
/** ANAKKALA START **/
NamedValue[] catNV = cat.getRequestedAttributes();
if( catNV != null && catNV.length >0)
for (int i=0; i<catNV.length; i++)
if(catNV[i].getName().equals("METADATA_ATTRIBUTES"))
//log("** CatNV.getName="+catNV[i].getName()+" value="+catNV[i].getValue());
Item[] meta = (Item[]) catNV[i].getValue();
log("meta length="+meta.length);
returnNV = new NamedValue[meta.length];
for (int j=0; j<meta.length; j++)
log("--Item getname="+meta[j].getName()+" value="+meta[j].getId()+" gettype="+meta[j].getType()+" gettypedesc="+meta[j].getTypeDesc());
returnNV[j] = new NamedValue(meta[j].getName(),meta[j].getName());
NamedValue[] metaNV = meta[j].getRequestedAttributes();
log("---metaNV length="+metaNV.length);
for(int k=0; k<metaNV.length; k++)
log("------metaNV.getName="+metaNV[k].getName()+" value="+metaNV[k].getValue());
/** ANAKKALA END **/
//NamedValue[] ret = null;
return returnNV; -
Getting error using the EMail Transport Protocol
Hi Gurus,
I am using the EMail Transport Protocol (Custom Document over Generic Exchange).
I am able to send the document using this protocol to a exchange server successfully. but when tried to receive the document from exchange server to Oracle B2B. I am getting the below error.
Description: Unable to identify the document protocol of the message
StackTrace:
Error -: AIP-50083: Document protocol identification error
at oracle.tip.adapter.b2b.engine.Engine.identifyDocument(Engine.java:3245)
at oracle.tip.adapter.b2b.engine.Engine.processIncomingMessage(Engine.java:1666)
at oracle.tip.adapter.b2b.engine.Engine.incomingContinueProcess(Engine.java:2574)
at oracle.tip.adapter.b2b.engine.Engine.handleMessageEvent(Engine.java:2444)
at oracle.tip.adapter.b2b.engine.Engine.processEvents(Engine.java:2399)
at oracle.tip.adapter.b2b.data.MsgListener.onMessage(MsgListener.java:527)
at oracle.tip.adapter.b2b.data.MsgListener.run(MsgListener.java:374)
at java.lang.Thread.run(Thread.java:534)
As per my knowledge all necessary properties are reaching Oracle B2B. Please go through the b2b.log content below.
2009.05.14 at 13:16:56:994: Thread-20: B2B - (DEBUG)
Protocol = Email
Version = null
Transport Header
SUBJECT:Test Message from SP
ACTION_NAME:CSVProcess
DATE:Thu, 14 May 2009 12:16:46 GMT
CONNECTION:close
TO:[email protected]
CONTENT-TYPE:multipart/mixed; boundary="----=_Part_3_11019994.1242303406228"
MIME-VERSION:1.0
X-MAILER:IPTransport
FROM_PARTY:EmailTP_GI
DOCTYPE_NAME:CSVProcess_DT
DOCTYPE_REVISION:1.0
FROM:EmailTP_GI
MESSAGE-ID:AC18E52A1213F0D9FB9000001629E7B0
RECEIVED:from INBAAMPC00933 ([172.24.229.42]) by vitz.techm.com (IceWarp 9.1.1) with ESMTP id VRE73645 for <[email protected]>; Thu, 14 May 2009 13:16:45 +0100
TO_PARTY:EmailSP_GI
Content-Type:application/b2b; name="Test Message from SP"
Sample Email Test1
Sample Email Test1
Sample Email Test1
Sample Email Test1
Sample Email Test1
Sample Email Test1
Sample Email Test1
Sample Email Test1
Sample Email Test1
Sample Email Test1
2009.05.14 at 13:16:57:057: Thread-20: B2B - (DEBUG) DBContext beginTransaction: Enter
2009.05.14 at 13:16:57:057: Thread-20: B2B - (DEBUG) DBContext beginTransaction: Transaction.begin()
2009.05.14 at 13:16:57:057: Thread-20: B2B - (DEBUG) DBContext beginTransaction: Leave
2009.05.14 at 13:16:57:057: Thread-20: B2B - (DEBUG) InterfaceListener:onMessage - Invoke inbound callout - null - null
2009.05.14 at 13:16:57:057: Thread-20: B2B - (DEBUG) InterfaceListenersyncAckEBMSchecking header names
2009.05.14 at 13:16:57:057: Thread-20: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:insertNativeEvtTblRow(2 params) Enter
2009.05.14 at 13:16:57:088: Thread-20: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:insertNativeEvtTblRow(2 params) Exit
2009.05.14 at 13:16:57:088: Thread-20: B2B - (DEBUG) oracle.tip.adapter.b2b.transport.InterfaceListener:onMessage sendEventtrue
2009.05.14 at 13:16:57:088: Thread-20: B2B - (DEBUG) DBContext commit: Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.data.MsgListener:onMessage Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) DBContext beginTransaction: Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) DBContext beginTransaction: Transaction.begin()
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) DBContext beginTransaction: Leave
2009.05.14 at 13:16:57:104: Thread-19: B2B - (INFORMATION) oracle.tip.adapter.b2b.engine.Engine:processEvents Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processEvents begin transaction
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) DBContext beginTransaction: Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) DBContext beginTransaction: Leave
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleMessageEvent Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:incomingContinueProcess Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:getWireMessage Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:getWireMessage Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:formTransportMessage Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:formTransportMessage Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (INFORMATION) oracle.tip.adapter.b2b.engine.Engine:processIncomingMessage Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processIncomingMessage Identify Business Protocol
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processIncomingMessage Do Unpack using the BP specific package class
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:unpack:Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:doUnpack:Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMessageContent:Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processInputStreamOrStringMessage:Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processInputStreamOrStringMessage:Content Type = application/b2b; name="Test Message from SP"
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:newMimeBodyPart.getAllHeaders()
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:getting content info
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:setContentTypeInfo:Enter
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:setContentTypeInfo:Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:newMimeBodyPart.getContent()
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:check content type(InputStream/String)
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:contentObj instanceof InputStream
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:addMimeBodyPartToMessageInfoString()
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMimeBodyPart:Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processInputStreamOrStringMessage:Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:processMessageContent:Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:doUnpack:Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) MimePackaging:unpack:Exit
2009.05.14 at 13:16:57:104: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processIncomingMessage Decode the Incoming Message into B2B Message
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:GenericExchangePlugin:decodeIncomingMessage Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:GenericExchangePlugin:decodeIncomingMessage Number of Components = 1
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage Transport Protocol = {Email}
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage fromTPoveride = null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage fromParty = EmailTP_GI tmpFromParty :EmailTP_GI
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage fromTPName ..GOT FROM CACHE= null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage Remote TP Name = null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) calling setInitiatingPartyId() changing from null to TPName: null Type: Generic Identifier Value: EmailTP_GI
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage toTPoveride = null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage Host TP Name = null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:decodeIncomingMessage fromParty = EmailTP_GI
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) calling setFromPartyId() changing from null to TPName: null Type: Generic Identifier Value: EmailTP_GI
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) calling setToPartyId() changing from null to TPName: null Type: Generic Identifier Value: [email protected]
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:GenericExchangePlugin:decodeIncomingMessage security info NULL
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.exchange.generic.GenericExchangePlugin:GenericExchangePlugin:decodeIncomingMessage Exit
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processHubMessage Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processHubMessage toTP [email protected]
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processHubMessage hubUrl null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processHubMessage Exit
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processIncomingMessage ProtocolCollabId = null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processIncomingMessage CollaborationName null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:checkDuplicate Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:checkDuplicate check non-RosettaNet Message
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:checkDuplicate Exit
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:processIncomingMessage Protocol Collaboration Id : null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.document.custom.CustomDocumentPlugin:identifyIncomingDocument Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.document.custom.CustomDocumentPlugin:identifyIncomingDocument Exit
2009.05.14 at 13:16:57:119: Thread-19: B2B - (ERROR) Error -: AIP-50083: Document protocol identification error
at oracle.tip.adapter.b2b.engine.Engine.identifyDocument(Engine.java:3245)
at oracle.tip.adapter.b2b.engine.Engine.processIncomingMessage(Engine.java:1666)
at oracle.tip.adapter.b2b.engine.Engine.incomingContinueProcess(Engine.java:2574)
at oracle.tip.adapter.b2b.engine.Engine.handleMessageEvent(Engine.java:2444)
at oracle.tip.adapter.b2b.engine.Engine.processEvents(Engine.java:2399)
at oracle.tip.adapter.b2b.data.MsgListener.onMessage(MsgListener.java:527)
at oracle.tip.adapter.b2b.data.MsgListener.run(MsgListener.java:374)
at java.lang.Thread.run(Thread.java:534)
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleExceptionBeforeIncomingTPA Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:XXX: handleInboundException Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:XXX: handleInboundException Error message is Error -: AIP-50083: Document protocol identification error
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:XXX: isFARequired Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:XXX: isFARequired {SUBJECT=Test Message from SP, ACTION_NAME=CSVProcess, DATE=Thu, 14 May 2009 12:16:46 GMT, CONNECTION=close, [email protected], CONTENT-TYPE=multipart/mixed; boundary="----=_Part_3_11019994.1242303406228", MIME-VERSION=1.0, X-MAILER=IPTransport, FROM_PARTY=EmailTP_GI, DOCTYPE_NAME=CSVProcess_DT, DOCTYPE_REVISION=1.0, FROM=EmailTP_GI, MESSAGE-ID=AC18E52A1213F0D9FB9000001629E7B0, RECEIVED=from INBAAMPC00933 ([172.24.229.42]) by vitz.techm.com (IceWarp 9.1.1) with ESMTP id VRE73645 for <[email protected]>; Thu, 14 May 2009 13:16:45 +0100, TO_PARTY=EmailSP_GI, Content-Type=application/b2b; name="Test Message from SP"}
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:XXX: isFARequired returning false
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:XXX: handleInboundException FA not required
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleInboundException Updating Error Message: Error -: AIP-50083: Document protocol identification error
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Enter
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Wire message found
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Creating new b2berror object
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState enum0 not null
2009.05.14 at 13:16:57:119: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Updating wire message error information
2009.05.14 at 13:16:57:135: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Updating wire message protocol message id
2009.05.14 at 13:16:57:151: Thread-20: B2B - (DEBUG) DBContext commit: Transaction.commit()
2009.05.14 at 13:16:57:151: Thread-20: B2B - (DEBUG) DBContext commit: Leave
2009.05.14 at 13:16:57:370: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Updating wire message payload storage
2009.05.14 at 13:16:57:386: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Creating new business message
2009.05.14 at 13:16:57:386: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:insertMsgTblRow Enter
2009.05.14 at 13:16:57:386: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:insertMsgTblRow toparty name null
2009.05.14 at 13:16:57:386: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:insertMsgTblRow toparty type and value Generic [email protected]
2009.05.14 at 13:16:57:386: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:insertMsgTblRow BusinessAction for the given name null null
2009.05.14 at 13:16:57:401: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Updating business message error information
2009.05.14 at 13:16:57:401: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateWireBusinessToErrorState Exit
2009.05.14 at 13:16:57:401: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleInboundException Updating Native Event Tbl Row
2009.05.14 at 13:16:57:401: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:DbAccess:updateNativeEvtTblRow Enter
2009.05.14 at 13:16:57:401: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:updateNativeEvtTblRow msgInfo.id = AC18E52A1213F0D9FB9000001629E7B0
2009.05.14 at 13:16:57:401: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.msgproc.DbAccess:
** DbAccess:updateNativeEvtTblRow:tip_wireMsg protocolCollabID = null
2009.05.14 at 13:16:57:433: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleInboundException notifying App
2009.05.14 at 13:16:57:433: Thread-19: B2B - (DEBUG) Engine:notifyApp Enter
2009.05.14 at 13:16:57:433: Thread-19: B2B - (DEBUG) notifyApp:notifyApp Enqueue the ip exception message:
<Exception xmlns="http://integration.oracle.com/B2B/Exception" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<correlationId>null</correlationId>
<b2bMessageId>AC18E5411213F0DCB100000013829EB0</b2bMessageId>
<errorCode>AIP-50083</errorCode>
<errorText>Document protocol identification error</errorText>
<errorDescription>
<![CDATA[Machine Info: (INBAAMPC00883)
Description: Unable to identify the document protocol of the message
StackTrace:
Error -: AIP-50083: Document protocol identification error
at oracle.tip.adapter.b2b.engine.Engine.identifyDocument(Engine.java:3245)
at oracle.tip.adapter.b2b.engine.Engine.processIncomingMessage(Engine.java:1666)
at oracle.tip.adapter.b2b.engine.Engine.incomingContinueProcess(Engine.java:2574)
at oracle.tip.adapter.b2b.engine.Engine.handleMessageEvent(Engine.java:2444)
at oracle.tip.adapter.b2b.engine.Engine.processEvents(Engine.java:2399)
at oracle.tip.adapter.b2b.data.MsgListener.onMessage(MsgListener.java:527)
at oracle.tip.adapter.b2b.data.MsgListener.run(MsgListener.java:374)
at java.lang.Thread.run(Thread.java:534)
]]>
</errorDescription>
<errorSeverity>2</errorSeverity>
</Exception>
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) Engine:notifyApp Exit
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleInboundException Updated the Error Message Successfully: Error -: AIP-50083: Document protocol identification error
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:XXX: handleInboundException Exit
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleExceptionBeforeIncomingTPA Exit
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:incomingContinueProcess Exit
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.engine.Engine:handleMessageEvent Exit
2009.05.14 at 13:16:57:448: Thread-19: B2B - (INFORMATION) oracle.tip.adapter.b2b.engine.Engine:processEvents Exit
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) DBContext commit: Enter
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) DBContext commit: Transaction.commit()
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) DBContext commit: Leave
2009.05.14 at 13:16:57:448: Thread-19: B2B - (DEBUG) oracle.tip.adapter.b2b.data.MsgListener:onMessage Exit
Kindly look into this.
Regards,
VithalHi Nandagopal,
I have configured email idc to send the payload as an attachment. & the attachment I am trying is send is a simple text file. So I am stuck here, how can I check against xPath for the mail :(.
I have copied the sample message below which is there in the SMTP server & ready to be fetched by Oracle B2B. This is how message looks like in the exchange server, before it gets consumed by Oracle B2B.
============================================================
Message-ID: AC18E52A121544A46D4000001629E840
DATE: Mon, 18 May 2009 15:15:02 GMT
From: [email protected]
FROM: EmailTP_GI
To: [email protected]
Subject: Test Message from SP
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_6_17282414.1242659702625"
X-Mailer: IPTransport
ACTION_NAME: CSVProcess
DOCTYPE_NAME: CSVProcess_DT
FROM_PARTY: EmailTP_GI
DOCTYPE_REVISION: 1.0
TO_PARTY: EmailSP_GI
Connection: close
------=_Part_6_17282414.1242659702625
Content-Type: application/b2b; name="Test Message from SP"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Test Message from SP"
PGRvY3VtZW50IHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL0JUZUJvbmQuaHAuY29tIGZpbGU6
L0Q6L3RyYW5zZm9ybWF0aW9uLWVuZ2luZS9yaWNoYXJkL3NjaGVtYTAueHNkIiB4bWxuczp4c2k9
Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4bWxucz0iaHR0cDov
L0JUZUJvbmQuaHAuY29tIj4KCgogICAgPHRyYW5zX2lkPnRyYW5zX2lkMDwvdHJhbnNfaWQ+Cgog
ICAgPGUyZV9pZD5lMmVfaWQwPC9lMmVfaWQ+CgogICAgPG1zZ190c3RhbXA+MjAwNi0wNS0wNFQx
ODoxMzo1MS4wWjwvbXNnX3RzdGFtcD4KCiAgICA8dHJhbnNfdHlwZT5JTkNJREVOVDwvdHJhbnNf
dHlwZT4KCiAgICA8dHJhbnNfc3ViX3R5cGU+Q1JFQVRFPC90cmFuc19zdWJfdHlwZT4KCiAgICA8
c2NfdHlwZT5JTjwvc2NfdHlwZT4KICAgIDxzZW5kZXJfaWQ+c2VuZGVyX2lkMDwvc2VuZGVyX2lk
PgoKICAgIDxzZW5kZXJfdGlja2V0X2lkPnNlbmRlcl90aWNrZXRfaWQwPC9zZW5kZXJfdGlja2V0
X2lkPgogICAgPGRlc3RfaWQ+ZGVzdF9pZDA8L2Rlc3RfaWQ+CiAgICA8ZGVzdF90aWNrZXRfaWQ+
ZGVzdF90aWNrZXRfaWQwPC9kZXN0X3RpY2tldF9pZD4KCiA8YWNrX3N0YXR1cz5hY2s8L2Fja19z
dGF0dXM+CiAgICA8YWNrX21zZz5hY2ttc2c8L2Fja19tc2c+CiAgICA8Y2FsbGVyPgogICAgICAg
IDxzZWFyY2hjb2RlPnNlYXJjaDwvc2VhcmNoY29kZT4KICAgICAgICA8ZW1haWw+YnRzZW50cnlA
YnQuY29tPC9lbWFpbD4KICAgICAgICA8Zmlyc3RfbmFtZT5Tb3VyYXY8L2ZpcnN0X25hbWU+CiAg
ICAgICAgPGxhc3RfbmFtZT5HYW5ndWx5PC9sYXN0X25hbWU+CiAgICAgICAgPHRlbGVwaG9uZT4x
MjM0NTY8L3RlbGVwaG9uZT4KICAgICAgICA8c3RyZWV0MT5TYWx0IExha2UgQ2l0eTwvc3RyZWV0
MT4KICAgICAgICA8c3RyZWV0Mj5Lb2w8L3N0cmVldDI+CiAgICAgICAgPGNpdHk+S29sa2F0YTwv
Y2l0eT4KICAgICAgICA8c3RhdGVfcHJvdmluY2U+V2VzdCBCZW5nYWw8L3N0YXRlX3Byb3ZpbmNl
PgogICAgICAgIDxjb3VudHJ5PkluZGlhPC9jb3VudHJ5PgogICAgICAgIDx6aXBfY29kZT41NjAw
MTY8L3ppcF9jb2RlPgogICAgPC9jYWxsZXI+CgogICAgPHByaW9yaXR5PkhpZ2g8L3ByaW9yaXR5
PgogICAgPGltcGFjdD5EaWFzdHJvdXM8L2ltcGFjdD4KICAgIDxzdGF0dXM+QWN0aXZlPC9zdGF0
dXM+CiAgICA8c3RhdHVzX2NoYW5nZV90c3RhbXA+CiAgICAgICAgMjAwMi0xMC0xMFQxMjowMDow
MC0wNTowMAogICAgPC9zdGF0dXNfY2hhbmdlX3RzdGFtcD4KCgoKCgogICAgPGhwX2lkPmhwX2lk
MDwvaHBfaWQ+CiAgICA8Y2VfaWQ+Y2VfaWQwPC9jZV9pZD4KCgo8ZGVzY3JpcHRpb24+Tm8gY29v
bDwvZGVzY3JpcHRpb24+CiAgICA8aW5mbz5UaGlzIGlzIGNvb2w8L2luZm8+CiAgICA8d29ya2xv
Zz5sb2dnaW5mPC93b3JrbG9nPgogICAgPHdvcmtncm91cD5JbmRlZWQ8L3dvcmtncm91cD4KICAg
IDxjbGFzc2lmaWNhdGlvbj5jbGFzczwvY2xhc3NpZmljYXRpb24+CiAgICA8Y2xvc3VyZV9jb2Rl
PjExMjwvY2xvc3VyZV9jb2RlPgogICAgPGNsb3N1cmVfY29kZV9kZXNjPjEwMDwvY2xvc3VyZV9j
b2RlX2Rlc2M+CiAgICA8c29sdXRpb24+UmVxdWlyZXM8L3NvbHV0aW9uPgoKCjxjb21wbGV0aW9u
X2RhdGU+MjAwMi0xMC0xMFQxMjowMDowMC0wNTowMDwvY29tcGxldGlvbl9kYXRlPgogICAgPGNj
ZD4yMDAyLTEwLTEwVDEyOjAwOjAwLTA1OjAwPC9jY2Q+CiAgICA8Y2NkX2RldGFpbHM+VGVjaE08
L2NjZF9kZXRhaWxzPgoKCgo8Y2k+CiAgICAgICAgPHNlYXJjaGNvZGU+NTYwMDE2PC9zZWFyY2hj
b2RlPgogICAgICAgIDxzdHJlZXQxPjJuZCBDcm9zcyA0dGggTWFpbjwvc3RyZWV0MT4KICAgICAg
ICA8c3RyZWV0Mj5TYWRhbmFuZCBOYWdhcjwvc3RyZWV0Mj4KICAgICAgICA8Y2l0eT5CYW5nYWxv
cmU8L2NpdHk+CiAgICAgICAgPHN0YXRlPkthcm5hdGFrYTwvc3RhdGU+CiAgICAgICAgPHppcGNv
ZGU+NTYwMDE2PC96aXBjb2RlPgogICAgICAgIDxjb3VudHJ5PkluZGlhPC9jb3VudHJ5PgogICAg
ICAgIDxtYWtlPkluZGlhPC9tYWtlPgogICAgICAgIDxtb2RlbD4xOTk2PC9tb2RlbD4KICAgICAg
ICA8c2VyaWFsX25vPjEyMzQ1Njc4OTwvc2VyaWFsX25vPgogICAgICAgIDxhc3NldF9ubz4xMjM0
NTY3ODk8L2Fzc2V0X25vPgogICAgICAgIDxuYW1lMT5Sb2NrPC9uYW1lMT4KICAgICAgICA8bmFt
ZTI+T248L25hbWUyPgogICAgICAgIAogICAgPC9jaT4KCgo8c2VydmljZT5NTEM8L3NlcnZpY2U+
CiAgICA8c2VydmljZV9pbXBhY3RlZD5ZZXM8L3NlcnZpY2VfaW1wYWN0ZWQ+CiAgIDwhLS0gPGNs
b3N1cmVfZGF0ZT4yMDAyLTEwLTEwVDEyOjAwOjAwLTA1OjAwPC9jbG9zdXJlX2RhdGU+IC0tPgog
ICAgPHJlZ19jcmVhdGVkPjIwMDItMTAtMTBUMTI6MDA6MDAtMDU6MDA8L3JlZ19jcmVhdGVkPgog
ICAgPHRhcmdldF9kYXRlPjIwMDItMTAtMTBUMTI6MDA6MDAtMDU6MDA8L3RhcmdldF9kYXRlPgoK
ICAgIDxyZXFfc3RhcnRfdHN0YW1wPjIwMDItMTAtMTBUMTI6MDA6MDAtMDU6MDA8L3JlcV9zdGFy
dF90c3RhbXA+CjxlY2hvPnNpbXBsZTwvZWNobz4KCgoKPC9kb2N1bWVudD4=
------=_Part_6_17282414.1242659702625--
======================================================
Regards,
Vithal -
How to read text file content in portal application?
Hi,
How do we read text file content in portal application?
Can anyone forward the code to do do?
Regards,
AnaghaCheck the code below. This help you to know how to read the text file content line by line. You can display as you require.
IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
IResourceContext resourceContext = new ResourceContext(user);
String filePath = "/documents/....";
RID rid = RID.getRID(filePath);
IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
InputStream inputStream = resource.getContent().getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = reader.readLine();
while(line!=null) {
line = reader.readLine();
//You can append in string buffer to get file content as string object//
Regards,
Yoga -
Hello,
The post method needs a redirection. It shows the url in DEBUG but response gives the same html page & not the new redirect one.
Here is the POST method:
public String POST(String url, NameValuePair[] data) {
String res = "";
String URL = ymailSinupUrl + "&_ylt=A9FJpMBjCkRHERcBDgCZ2PAI";
NameValuePair formData[] = {
new NameValuePair("u", _dsh), new NameValuePair("t", _t1),
new NameValuePair("preferredcontent", this.preferLang), new NameValuePair("firstname", FirstName), new NameValuePair("secondname", LastName), new NameValuePair("gender", this.gender), new NameValuePair("mm", this.bMm), new NameValuePair("dd", bDate), new NameValuePair("yyyy", bYyyy), new NameValuePair("country", loc), new NameValuePair("postalcode", postalCode),
new NameValuePair("yahooid", Email), new NameValuePair("password", Passwrd), new NameValuePair("passwordconfirm", passwrdAgain),
new NameValuePair("altemail", this.alterEmail), new NameValuePair("secquestion", selection), new NameValuePair("secquestionanswer", this.IdentifyAnswer), new NameValuePair("cword", newaccountcaptcha), new NameValuePair("cdata", this._continue), new NameValuePair("tos_agreed", this.doAgree), new NameValuePair("IAgreeBtn", submitbutton)
PostMethod postMethod = new PostMethod(URL);
postMethod.setRequestBody(formData);
int statusCode = 0;
try {
statusCode = client.executeMethod(hc, postMethod);
System.out.println("Register Send: " + postMethod.getStatusLine().toString());
postMethod.releaseConnection();
}catch (HttpException e) {
postMethod.releaseConnection();
System.out.println("HTTP EXception : " + e.getMessage());
}catch (IOException ie) {
postMethod.releaseConnection();
System.out.println("Error Exe Method - Post. Status Code = " + statusCode);
ie.printStackTrace();
// To find whether logon is suceeded is, retreive the cookie
Cookie[] logoncookies = cookiespec.match(
ymailSinupUrl, hc.getPort(), "/", false, client.getState().getCookies());
System.out.println("Logon cookies:");
if (logoncookies.length == 0) {
System.out.println("None");
} else {
for (int i = 0; i < logoncookies.length; i++) {
System.out.println("- " + logoncookies.toString());
// Save the url in lastUrl to keep track of
try {
lastUrl = postMethod.getURI().toString();
} catch (HttpException he) {
he.printStackTrace();
statusCode = postMethod.getStatusCode();
if ((statusCode == HttpStatus.SC_MOVED_TEMPORARILY) ||
(statusCode == HttpStatus.SC_MOVED_PERMANENTLY) ||
(statusCode == HttpStatus.SC_SEE_OTHER) ||
(statusCode == HttpStatus.SC_TEMPORARY_REDIRECT)) {
Header header = postMethod.getResponseHeader("Location");
if (header != null) {
String newUri = header.getValue();
System.out.println("Header Location = " + newUri);
if ((newUri == null) || (newUri.equals(""))) {
newUri = "/";
try {
// REQUIRES RE-DIRECT
System.out.println("RE DIRECTING TARGET .....");
GetMethod redirect = new GetMethod(h.getValue());
redirect.setRequestHeader("Cookie",logoncookies.toString());
client.executeMethod(redirect);
InputStream inputStream = null;
BufferedReader input = null;
try {
inputStream = redirect.getResponseBodyAsStream();
input = new BufferedReader(new InputStreamReader(inputStream));
String str;
StringBuffer response = new StringBuffer();
while((str = input.readLine()) != null) {
response.append((new StringBuilder()).append(str).append("\n").toString());
res = (new StringBuilder()).append(res).append(str).toString();
res = response.toString();
input.close();
} catch (IOException ie) {
redirect.releaseConnection();
ie.printStackTrace();
System.out.println("Redirect: " + redirect.getStatusLine().toString());
System.out.println("Redirect: " + redirect.getRequestHeader("path"));
// release any connection resources used by the method
redirect.releaseConnection();
} catch (Exception e) {
System.out.println("Exp in Redirecting:-" + e.getMessage());
e.printStackTrace();
} else {
System.out.println("Invalid Redirect...........");
System.exit(1);
System.out.println((new StringBuilder()).append("Status Code = ").append(statusCode).toString());
System.out.println("REPLY FROM POS = " + res);
return res;
tHE dEBUG of whole program is as follows:
init:
deps-jar:
Compiling 1 source file to E:\Trupti\Projects\Sol Edad\Yname Maker\build\classes
compile:
2007/11/22 15:11:07:090 IST [DEBUG] HttpClient - Java version: 1.6.0_02
2007/11/22 15:11:07:090 IST [DEBUG] HttpClient - Java vendor: Sun Microsystems Inc.
2007/11/22 15:11:07:090 IST [DEBUG] HttpClient - Java class path: E:\Trupti\JakartaApache\commons-codec-1.3.jar;E:\Trupti\JakartaApache\commons-httpclient-3.0.1.jar;E:\Trupti\JakartaApache\commons-lang-2.3.jar;E:\Trupti\JakartaApache\commons-logging-1.1.jar;E:\Trupti\Projects\Sol Edad\Yname Maker\build\classes
2007/11/22 15:11:07:090 IST [DEBUG] HttpClient - Operating system name: Windows XP
2007/11/22 15:11:07:090 IST [DEBUG] HttpClient - Operating system architecture: x86
2007/11/22 15:11:07:090 IST [DEBUG] HttpClient - Operating system version: 5.1
2007/11/22 15:11:07:215 IST [DEBUG] HttpClient - SUN 1.6: SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration)
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - SunRsaSign 1.5: Sun RSA signature provider
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - SunJSSE 1.6: Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - SunJCE 1.6: SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos v5, SPNEGO)
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - SunSASL 1.5: Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - XMLDSig 1.0: XMLDSig (DOM XMLSignatureFactory; DOM KeyInfoFactory)
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - SunPCSC 1.6: Sun PC/SC provider
2007/11/22 15:11:07:231 IST [DEBUG] HttpClient - SunMSCAPI 1.6: Sun's Microsoft Crypto API provider
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.useragent = Jakarta Commons-HttpClient/3.0.1
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.protocol.version = HTTP/1.1
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.connection-manager.class = class org.apache.commons.httpclient.SimpleHttpConnectionManager
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.protocol.cookie-policy = rfc2109
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.protocol.element-charset = US-ASCII
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.protocol.content-charset = ISO-8859-1
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.method.retry-handler = [email protected]
2007/11/22 15:11:07:231 IST [DEBUG] DefaultHttpParams - Set parameter http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss z]
2007/11/22 15:11:07:246 IST [DEBUG] DefaultHttpParams - Set parameter http.protocol.version = HTTP/1.0
2007/11/22 15:11:07:246 IST [DEBUG] DefaultHttpParams - Set parameter http.protocol.version = HTTP/1.0
Landing on Signup Page
2007/11/22 15:11:07:246 IST [DEBUG] DefaultHttpParams - Set parameter http.protocol.cookie-policy = null
2007/11/22 15:11:07:293 IST [DEBUG] DefaultHttpParams - Set parameter http.method.rety-handler = [email protected]1b
2007/11/22 15:11:07:309 IST [DEBUG] HttpConnection - Open connection to edit.yahoo.com:443
2007/11/22 15:11:07:981 IST [DEBUG] header - >> "GET /registration?.intl=us&new=1&.done=http HTTP/1.0[\r][\n]"
2007/11/22 15:11:07:981 IST [DEBUG] HttpMethodBase - Adding Host request header
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20061201 Firefox/2.0.0.3 (Ubuntu-feisty)[\r][\n]"
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5[\r][\n]"
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "Accept-Language: en-US[\r][\n]"
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7[\r][\n]"
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "Keep-Alive: 300[\r][\n]"
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "Connection: keep-alive[\r][\n]"
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "Host: edit.yahoo.com[\r][\n]"
2007/11/22 15:11:08:012 IST [DEBUG] header - >> "[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "Date: Thu, 22 Nov 2007 09:41:08 GMT[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "Set-Cookie: B=ef69pm53kajlk&b=3&s=q3; expires=Tue, 02-Jun-2037 20:00:00 GMT; path=/; domain=.yahoo.com[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "Cache-control: no-cache[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "Pragma: no-cache[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "Expires: 0[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "Connection: close[\r][\n]"
2007/11/22 15:11:09:652 IST [DEBUG] header - << "Content-Type: text/html[\r][\n]"
2007/11/22 15:11:09:699 IST [DEBUG] HttpMethodBase - Cookie accepted: "$Version=0; B=ef69pm53kajlk&b=3&s=q3; $Path=/; $Domain=.yahoo.com"
Status Code = 200
Got RESPONSE :- ***************************** HTML CODE ****************************************
Initial set of cookies:
Ini Cookies: None
Cookie = B = ef69pm53kajlk&b=3&s=q3
Form Action = /registration;_ylt=A9FJq3.0TkVHN80ADgCZ2PAI
Captcha URL - https://ab.login.yahoo.com/img/4.tPSeVZFemXYoQV0NICmWnGQ501fk1P1.dvnHUeJXY.iqAJA.in8Ne.4Q6e64fly4gkf3kRkQ--.jpg
Continue = 4.tPSeVZFemXYoQV0NICmWnGQ501fk1P1.dvnHUeJXY.iqAJA.in8Ne.4Q6e64fly4gkf3kRkQ--
DSH - U = c43neat3kajlk
T1 = 0kGqAw2P05N6ep_jQ3V10QQtjOlDOl1TAvxdpkLTjgc1qW0i_V89yZbsoWFsk9Wl4KUh9vEmpnQ4_qp68PmUEimVv9mFLdRDUju7iDo8fQQ1hhbeL48NxPQD5i_aaZ3Pi6TJXAhoEuTL3QUqRn9CsKi6s.hqPg32AK_DBTCEwY0-~B
Dracs =
POSTING FORM ....
2007/11/22 15:11:33:401 IST [DEBUG] HttpConnection - Open connection to edit.yahoo.com:443
2007/11/22 15:11:33:760 IST [DEBUG] header - >> "POST /registration?.intl=us&new=1&.done=http&_ylt=A9FJpMBjCkRHERcBDgCZ2PAI HTTP/1.0[\r][\n]"
2007/11/22 15:11:33:776 IST [DEBUG] HttpMethodBase - Adding Host request header
2007/11/22 15:11:33:792 IST [DEBUG] HttpMethodBase - Default charset used: ISO-8859-1
2007/11/22 15:11:33:995 IST [DEBUG] HttpMethodBase - Default charset used: ISO-8859-1
2007/11/22 15:11:34:182 IST [DEBUG] header - >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
2007/11/22 15:11:34:213 IST [DEBUG] header - >> "Host: edit.yahoo.com[\r][\n]"
2007/11/22 15:11:34:229 IST [DEBUG] header - >> "Cookie: $Version=0; B=ef69pm53kajlk&b=3&s=q3; $Path=/; $Domain=.yahoo.com[\r][\n]"
2007/11/22 15:11:34:245 IST [DEBUG] header - >> "Content-Length: 676[\r][\n]"
2007/11/22 15:11:34:276 IST [DEBUG] header - >> "Content-Type: application/x-www-form-urlencoded[\r][\n]"
2007/11/22 15:11:34:292 IST [DEBUG] header - >> "[\r][\n]"
2007/11/22 15:11:35:370 IST [DEBUG] EntityEnclosingMethod - Request body sent
2007/11/22 15:11:35:682 IST [DEBUG] header - << "HTTP/1.1 301 Moved Permanently[\r][\n]"
2007/11/22 15:11:35:729 IST [DEBUG] header - << "Date: Thu, 22 Nov 2007 09:41:35 GMT[\r][\n]"
2007/11/22 15:11:35:745 IST [DEBUG] header - << "Location: http://edit.yahoo.com/registration?.intl=us&new=1&.done=http[\r][\n]"
2007/11/22 15:11:35:760 IST [DEBUG] header - << "Connection: close[\r][\n]"
2007/11/22 15:11:35:776 IST [DEBUG] header - << "Content-Type: text/html[\r][\n]"
2007/11/22 15:11:35:791 IST [DEBUG] HttpMethodDirector - Redirect required
2007/11/22 15:11:35:791 IST [INFO] HttpMethodDirector - Redirect requested but followRedirects is disabled
Register Send: HTTP/1.1 301 Moved Permanently
2007/11/22 15:11:39:604 IST [DEBUG] HttpMethodBase - Should close connection in response to directive: close
2007/11/22 15:11:39:619 IST [DEBUG] HttpConnection - Releasing connection back to connection manager.
Logon cookies:
None
Header = http://edit.yahoo.com/registration?.intl=us&new=1&.done=http
RE DIRECTING TARGET .....
2007/11/22 15:12:02:384 IST [DEBUG] HttpConnection - Open connection to edit.yahoo.com:80
2007/11/22 15:12:02:727 IST [DEBUG] header - >> "GET /registration?.intl=us&new=1&.done=http HTTP/1.0[\r][\n]"
2007/11/22 15:12:02:743 IST [DEBUG] HttpMethodBase - Adding Host request header
2007/11/22 15:12:02:759 IST [DEBUG] header - >> "Cookie: [Lorg.apache.commons.httpclient.Cookie;@e4776b[\r][\n]"
2007/11/22 15:12:02:790 IST [DEBUG] header - >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
2007/11/22 15:12:02:821 IST [DEBUG] header - >> "Host: edit.yahoo.com[\r][\n]"
2007/11/22 15:12:02:837 IST [DEBUG] header - >> "Cookie: $Version=0; B=ef69pm53kajlk&b=3&s=q3; $Path=/; $Domain=.yahoo.com[\r][\n]"
2007/11/22 15:12:02:852 IST [DEBUG] header - >> "[\r][\n]"
2007/11/22 15:12:06:196 IST [DEBUG] header - << "HTTP/1.1 302 Found[\r][\n]"
2007/11/22 15:12:06:243 IST [DEBUG] header - << "Date: Thu, 22 Nov 2007 09:42:02 GMT[\r][\n]"
2007/11/22 15:12:06:290 IST [DEBUG] header - << "P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"[\r][\n]"
2007/11/22 15:12:06:305 IST [DEBUG] header - << "Location: https://edit.yahoo.com/registration?_intl=us&new=1&_done=http[\r][\n]"
2007/11/22 15:12:06:321 IST [DEBUG] header - << "Connection: close[\r][\n]"
2007/11/22 15:12:06:337 IST [DEBUG] header - << "Content-Type: text/html[\r][\n]"
<b>2007/11/22 15:12:06:352 IST [DEBUG] HttpMethodDirector - Redirect required
2007/11/22 15:12:06:368 IST [DEBUG] HttpMethodDirector - Redirect requested to location 'https://edit.yahoo.com/registration?_intl=us&new=1&_done=http'
2007/11/22 15:12:06:415 IST [DEBUG] HttpMethodDirector - Redirecting from 'http://edit.yahoo.com:80/registration' to 'https://edit.yahoo.com/registration</b>
2007/11/22 15:12:06:430 IST [DEBUG] HttpMethodDirector - Execute redirect 1 of 100
2007/11/22 15:12:06:446 IST [DEBUG] HttpMethodBase - Should close connection in response to directive: close
2007/11/22 15:12:06:462 IST [DEBUG] HttpConnection - Connection is locked. Call to releaseConnection() ignored.
2007/11/22 15:12:06:462 IST [DEBUG] HttpConnection - Releasing connection back to connection manager.
2007/11/22 15:12:06:477 IST [DEBUG] HttpConnection - Open connection to edit.yahoo.com:443
2007/11/22 15:12:06:821 IST [DEBUG] header - >> "GET /registration?_intl=us&new=1&_done=http HTTP/1.1[\r][\n]"
2007/11/22 15:12:06:837 IST [DEBUG] HttpMethodBase - Adding Host request header
2007/11/22 15:12:06:868 IST [DEBUG] header - >> "Cookie: [Lorg.apache.commons.httpclient.Cookie;@e4776b[\r][\n]"
2007/11/22 15:12:06:899 IST [DEBUG] header - >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
2007/11/22 15:12:06:915 IST [DEBUG] header - >> "Host: edit.yahoo.com[\r][\n]"
2007/11/22 15:12:06:930 IST [DEBUG] header - >> "Cookie: $Version=0; B=ef69pm53kajlk&b=3&s=q3; $Path=/; $Domain=.yahoo.com[\r][\n]"
2007/11/22 15:12:06:962 IST [DEBUG] header - >> "[\r][\n]"
2007/11/22 15:12:09:493 IST [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2007/11/22 15:12:09:555 IST [DEBUG] header - << "Date: Thu, 22 Nov 2007 09:42:07 GMT[\r][\n]"
2007/11/22 15:12:09:571 IST [DEBUG] header - << "P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"[\r][\n]"
2007/11/22 15:12:09:602 IST [DEBUG] header - << "Cache-control: no-cache[\r][\n]"
2007/11/22 15:12:09:618 IST [DEBUG] header - << "Pragma: no-cache[\r][\n]"
2007/11/22 15:12:09:633 IST [DEBUG] header - << "Expires: 0[\r][\n]"
2007/11/22 15:12:09:649 IST [DEBUG] header - << "Connection: close[\r][\n]"
2007/11/22 15:12:09:665 IST [DEBUG] header - << "Transfer-Encoding: chunked[\r][\n]"
2007/11/22 15:12:09:680 IST [DEBUG] header - << "Content-Type: text/html[\r][\n]"
2007/11/22 15:12:28:523 IST [DEBUG] HttpMethodBase - Should close connection in response to directive: close
2007/11/22 15:12:28:523 IST [DEBUG] HttpConnection - Releasing connection back to connection manager.The bold text says, that the header has some reference to go to other site, but the redirect.getResponseBodyAsStream(); returns the same page as Get. What is that I am lacking.
Any help is highly appreciated. Please guide me, I am in need of help.
Thankscotton.m wrote:
Have you considered the possibility that the site in question doesn't want to support requests from your client and is thus forwarding you to oblivion?I mean I'd well consider dropping a Jakarta client trying to register on my web page. It smells of spam -
Filling clob with non ascii characters
Hello,
I have had some problems with clobs and usage of german
umlauts (����). I was'nt able to insert or update
strings containing umlaute in combination with string
binding. After inserting or updating the umlaut
characters were replaced by strange (spanish) '?'
which were upside down.
However, it was working when I did not use string bindung.
I tried varios things, after some time I tracked
the problem down to to oracle.toplink.queryframework.SQLCall.java. In the
prepareStatement(...) you find something
like
ByteArrayInputStream inputStream = new ByteArrayInputStream(((String) parameter).getBytes());
// Binding starts with a 1 not 0.
statement.setAsciiStream(index + 1, inputStream,((String) parameter).getBytes().length);
I replaced the usage of ByteArrayInputStram with CharArrayReader:
// TH changed, 26.11.2003, Umlaut will not work with this.
CharArrayReader reader = new CharArrayReader(((String) parameter).toCharArray());
statement.setCharacterStream(index + 1, reader, ((String) parameter).length() );
and this worked.
Is there any other way achieving this? Did anyone
get clobs with non ascii characters to work?
Regards -- Tobias
(Toplink 9.0.3, Clob was mapped to String, Driver was Oracle OCI)I don't think the console font is the problem. I use Lat2-Terminus16 because I read the Beginner's Guide on the wiki while installing the system.
My /etc/vconsole.conf:
KEYMAP=de
FONT=Lat2-Terminus16
showconsolefont even shows me the characters missing in the file names; e.g.: Ö, Ä, Ü -
Displaying doc/txt file contents from portlet
Hi, Can someone pls give a hint on how to do this:
One "book" type content created, with a doc file uploaded. The "publisher " for
this content is set to "sams".
create a content selector which retrieves only this (content) book correctly.
create two portlets. one portlet with above content selector inserted, displays
the publisher name with a hyperlink.
I want the other portlet to display the contents of the file uploaded, for this
publisher. I could establish portlet comm. and could display other properties
of the book such as "author/titile" on the second portlet, but want to know how
to display the uploaded file contents.
thanks much,
-developerAs far as retriving the contents of an uploaded file...
If your XML document has been loaded into Content Management as a binary
property, you have two options:
a) to directly inline the content into the JSP, do something like this:
<cm:getProperty id="node" name="binaryPropertyName" failOnError="true"
isMultiple="false"/>
(This assumes node holds a reference to the Content Management Node
object (perhaps retrieved via a <cm:getNode> tag)
b) to retrieve the value into a script variable for more processing, do
something like this:
<%
Property bodyProp= (Property)node.getProperty("binaryPropertyName");
InputStream in= node.getPropertyBytes( bodyProp.getId() );
// dont forget to close the InputStream
String result=null;
InputStreamReader reader= new InputStreamReader(in);
StringBuffer streamContents= new StringBuffer();
char[] data= new char[8192];
int charsRead;
while ((charsRead = reader.read(data)) > 0 )
streamContents.append(data, 0, charsRead);
result= streamContents.toString();
%>
-Steve
"portal developer" <[email protected]> wrote in message
news:40ae343d$[email protected]..
>
Hi, Can someone pls give a hint on how to do this:
One "book" type content created, with a doc file uploaded. The "publisher" for
this content is set to "sams".
create a content selector which retrieves only this (content) bookcorrectly.
>
create two portlets. one portlet with above content selector inserted,displays
the publisher name with a hyperlink.
I want the other portlet to display the contents of the file uploaded,for this
publisher. I could establish portlet comm. and could display otherproperties
of the book such as "author/titile" on the second portlet, but want toknow how
to display the uploaded file contents.
thanks much,
-developer -
Jersey WebResource output as input for DOM parsing
I'm working with REST web services, and introducing myself to Jersey and DOM. The code below retrieves an XML response from Flickr's REST api (I know there are wrapper libraries for this API, but I want to learn the nuts and bolts of it).
Client client = Client.create();
WebResource webResource = client.resource("http://api.flickr.com/services/rest/");
MultivaluedMapImpl queryParams = new MultivaluedMapImpl();
queryParams.add("api_key", "<my key>");
queryParams.add("method", "flickr.photos.search");
queryParams.add("text", "dog");
queryParams.add("per_page", "10");
queryParams.add("page", "1");
String s = webResource.queryParams(queryParams).get(String.class);
's' in this case is the XML response as a String. What I want though, is to have the XML as an object of a class that can be passed as a parameter to the parse() method of org.w3c.dom.Document, as in the following:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document dom = db.parse(s);
The parse() method has five overloads:
parse(File f);
parse(InputSource is);
parse(InputStream is);
parse(String uri);
parse(InputStream, String systemId);
The one that takes a String is actually asking for a URI to the XML file. So what I want is to use the get() method of WebResource (above) to obtain the XML in a form that can be passed to one of the parse() methods. Does anybody know an efficient method of doing this? I don't really want to create a File just to pass it to the DocumentBuilder...Disclaimer : I know little of XML parsing APIs, I just browsed the API javadoc for this answer.
The parse() method has five overloads:
The one that takes a String is actually asking for a URI to the XML file.Good catch - I would have fallen in the trap too :o)
parse(File f);
parse(InputSource is);
parse(InputStream is);
parse(String uri);
parse(InputStream, String systemId);See the InputSource version: an InputSource instance can be built out of a StringReader.
Something along the lines of:
Document dom = db.parse(new InputSource(new StringReader(s)));J.
P.S.: please use tags when posting code.
Edited by: jduprez on May 8, 2011 10:06 PM -
BTE 503113 - FIS_VBREVK_1&FIS_VBREVK_2 always empty
Hi,
Did anyone worked with BTE 503113?
It seems FIS_VBREVK_1&FIS_VBREVK_2 are always empty.
It's called within FORM MAINTAIN_RR_STATUS (include LVFRRF0M), like this, so with dummy parameters:
perform maintain_rr_status using pis_xvbak
pis_xvbap
gcf_dummy_ctrl
gcf_dummy_ctrl
gvt_xvbreve-rrsta.
One exception in LVFRRF0M, however during my debugging session that part was not executed
Any idea?
Thanks in advance,
PeterHello,
i would not get the OutputStream by calling the Method "OutputStream os = myBlob.setBinaryStream(0);".
I use the Method "blobDest.getBinaryOutputStream();"
Unfortunately, it's not possible to use the abstract JDBC driver interface to set a BLOB (unlimited size) into a oracle database, or rather i don't how to do it...
Here is the code which i use to insert a inputstream to a blob. Please note: In this example a string-type is used for the ID. This might be adapted in your solution....
public static void setBlob(Connection connection, InputStream inputStream, String tableName,
String columnName, String recordID) throws SQLException, IOException
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT ID, "+columnName+" FROM "+tableName+" WHERE ID='"+recordID+"' FOR UPDATE");
resultSet.next();
oracle.sql.BLOB blobDest = (oracle.sql.BLOB) ((OracleResultSet) resultSet).getBlob(2);
byte[] buffer = new byte[ blobDest.getBufferSize() ];
OutputStream outputStream = blobDest.getBinaryOutputStream();
int length = -1;
while ((length = inputStream.read(buffer)) != -1) {
outputStream.write(buffer,0,length);
outputStream.flush();
statement.close();
outputStream.close();
inputStream.close();
resultSet.close();
Hope it's help
best regards
sschoenig
Maybe you are looking for
-
SAP CRM - no confidence in UI by SAP?
After reading this blog and looking at the article attached to the blog. I had an interesting question: Can Rich Internet Applications finally be accepted as a credible application development platform for SAP? Does SAP have any confidence in its ow
-
Can't get Java to work in IE 6!
I downloaded and installed the file jre-1_5_0_01-windows-i586-p-iftw.exe and couldn't get java to work on websites that used it. So I tried to install it again and got the message "You already have this version of the JRE installed. Please uninstall
-
Imovie 8.0.6 doesn't recognize video from Canon Mark 5d II
imovie 8.0.6 doesn't recognize video from Canon Mark 5d II, worked fine with 5d. imported into computer, exported thru iphoto, came out file ex. MOV which imovie doesn't read. Can I get iphoto to export dif. file ex.? 5d using same process file ex.
-
"Only one EHP Level in the system"?
I am reading a blog called "SAP enhancement packages for SAP ERP". At page 22, it says: "An Application system can only consist of one EHP level (e.g. EHP3 or EHP4). Hence installed EHP components have to be updated with every future EHP implementati
-
How do I get the 600 ex-rt off of ratios and put in power output?
I can't find it anywhere in my manual or the custom functions. For instance, it is showing the ratio of 1:4 instead of the power output of 1/4 power. I am using a Mark III. Thank you!