Hello,
does someone know a good bigenner's tutorial for OFBiz (Apache Open For Business). Please no google suggestions, cause i did. Thanks for any help.
Hello,
does someone know a good bigenner's tutorial for OFBiz (Apache Open For Business). Please no google suggestions, cause i did. Thanks for any help.
In spite of what you said I'm going to to a google reference
I followed some of the links myself and they look informative to me, but than again I know nothing about ofbiz.Code:http://www.google.com/search?q=ofbiz+tutorial&num=100
you can try this,
http://www.opensourcestrategies.com/ofbiz/tutorials.php
Hi all,
Im new to ofbiz.So is my question is have any mistake forgive me for my mistakes.Im new to ofbiz so i did not know some terminologies in ofbiz.Sometimes my question is not clear because of lack of knowledge in ofbiz.So try to understand my question and give me a good solution with respect to my level.Because some solutions are in very high level cannot able to understand for me.So please give the solution with good examples.
My problem is i created a project inside the ofbiz/hot-deploy folder namely "productionmgntSystem".Inside the folder "ofbiz\hot-deploy\productionmgntSystem\webapp\productionmgntSystem" i created a .ftl file namely "app_details_1.ftl" .The following are the coding of this file
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script TYPE="TEXT/JAVASCRIPT" language=""JAVASCRIPT">
function uploadFile()
{
//alert("Before calling upload.jsp");
window.location='<@ofbizUrl>testing_service1</@ofbizUrl>'
}
</script>
</head>
<!-- <form action="<@ofbizUrl>testing_service1</@ofbizUrl>" enctype="multipart/form-data" name="app_details_frm"> -->
<form action="<@ofbizUrl>logout1</@ofbizUrl>" enctype="multipart/form-data" name="app_details_frm">
<center style="height: 299px; ">
<table border="0" style="height: 177px; width: 788px">
<tr style="height: 115px; ">
<td style="width: 103px; ">
<td style="width: 413px; "><h1>APPLICATION DETAILS</h1>
<td style="width: 55px; ">
</tr>
<tr>
<td style="width: 125px; ">Application name : </td>
<td>
<input name="app_name_txt" id="txt_1" value=" " />
</td>
</tr>
<tr>
<td style="width: 125px; ">Excell sheet : </td>
<td>
<input type="file" name="filename"/>
</td>
</tr>
<tr>
<td>
<!-- <input type="button" name="logout1_cmd" value="Logout" onclick="logout1()"/> -->
<input type="submit" name="logout_cmd" value="logout"/>
</td>
<td>
<!-- <input type="submit" name="upload_cmd" value="Submit" /> -->
<input type="button" name="upload1_cmd" value="Upload" onclick="uploadFile()"/>
</td>
</tr>
</table>
</center>
</form>
</html>
the following coding is present in the file "ofbiz\hot-deploy\productionmgntSystem\webapp\productionmgntSystem\WEB-INF\controller.xml"
......
.......
........
<request-map uri="testing_service1">
<security https="true" auth="true"/>
<event type="java" path="org.ofbiz.productionmgntSystem.web_app_req.WebServices1" invoke="testingService"/>
<response name="ok" type="view" value="ok_view"/>
<response name="exception" type="view" value="exception_view"/>
</request-map>
..........
............
..........
<view-map name="ok_view" type="ftl" page="ok_view.ftl"/>
<view-map name="exception_view" type="ftl" page="exception_view.ftl"/>
................
.............
.............
The following are the coding present in the file "ofbiz\hot-deploy\productionmgntSystem\src\org\ofbiz\productionmgntSystem\web_app_req\WebServices1.java"
package org.ofbiz.productionmgntSystem.web_app_req;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.DataInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class WebServices1
{
public static String testingService(HttpServletRequest request, HttpServletResponse response)
{
//int i=0;
String result="ok";
System.out.println("\n\n\t*************************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response)- Start");
String contentType=request.getContentType();
System.out.println("\n\n\t*************************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response)- contentType : "+contentType);
String str=new String();
// response.setContentType("text/html");
//PrintWriter writer;
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
{
System.out.println("\n\n\t**********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) after if (contentType != null)");
try
{
// writer=response.getWriter();
System.out.println("\n\n\t**********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - try Start");
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
//this loop converting the uploaded file into byte code
while (totalBytesRead < formDataLength)
{
byteRead = in.read(dataBytes, totalBytesRead,formDataLength);
totalBytesRead += byteRead;
}
String file = new String(dataBytes);
//for saving the file name
String saveFile = file.substring(file.indexOf("filename=\"") + 10);
saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
saveFile = saveFile.substring(saveFile.lastIndexOf("\\")+ 1,saveFile.indexOf("\""));
int lastIndex = contentType.lastIndexOf("=");
String boundary = contentType.substring(lastIndex + 1,contentType.length());
int pos;
//extracting the index of file
pos = file.indexOf("filename=\"");
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
int boundaryLocation = file.indexOf(boundary, pos) - 4;
int startPos = ((file.substring(0, pos)).getBytes()).length;
int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
//creating a new file with the same name and writing the content in new file
FileOutputStream fileOut = new FileOutputStream("/"+saveFile);
fileOut.write(dataBytes, startPos, (endPos - startPos));
fileOut.flush();
fileOut.close();
System.out.println("\n\n\t**********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - try End");
}
catch(IOException ioe)
{
System.out.println("\n\n\t*********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - Catch IOException");
//ioe.printStackTrace();
return("exception");
}
catch(Exception ex)
{
System.out.println("\n\n\t*********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) - Catch Exception");
return("exception");
}
}
else
{
System.out.println("\n\n\t********************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response) else part");
result="exception";
}
System.out.println("\n\n\t*************************************\n\tInside WebServices1.testingService(HttpServletRequest request, HttpServletResponse response)- End");
return(result);
}
}
I want to upload a file to the server.The file is get from user "<input type="file"..> tag in the "app_details_1.ftl" file & it is updated into the server by using the method "testingService(HttpServletRequest request, HttpServletResponse response)" in the class "WebServices1".But the file is not uploaded. Give me a good solution for uploading a file to the server.
Thanks & Regards,
Sivakumar.J
hi SIVAKUMAR,
i'm not very familiar with OFBiz but i have had few encounters of this language...and i used this site to understand it...try this one
https://cwiki.apache.org/OFBIZ/ofbiz...ent-guide.html
that might help![]()
We are trying to invoke ofbiz service using below mentioned code:
package com.PartyId;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
public class Main {
private static OMFactory fac;
private static OMNamespace omNs;
static {
fac = OMAbstractFactory.getOMFactory();
omNs = fac.createOMNamespace("http://ofbiz.apache.org/service", "ns1");
}
public static void main(String[] args) throws AxisFault {
ServiceClient sc = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference(
"https://127.0.0.1:8443/webtools/control/SOAPService/getOrderHeaderInformation"));
opts.setAction("getOrderHeaderInformation");
sc.setOptions(opts);
OMElement res = sc.sendReceive(createPayLoad());
System.out.println(res);
}
private static OMElement createPayLoad() {
OMElement findPartiesById = fac.createOMElement("getOrderHeaderInformation", omNs);
OMElement mapMap = fac.createOMElement("map-Map", omNs);
findPartiesById.addChild(mapMap);
mapMap.addChild(createMapEntry("orderId", "WSCO10044"));
return findPartiesById;
}
private static OMElement createMapEntry(String key, String val) {
OMElement mapEntry = fac.createOMElement("map-Entry", omNs);
// create the key
OMElement mapKey = fac.createOMElement("map-Key", omNs);
OMElement keyElement = fac.createOMElement("std-String", omNs);
OMAttribute keyAttribute = fac.createOMAttribute("value", null, key);
mapKey.addChild(keyElement);
keyElement.addAttribute(keyAttribute);
// create the value
OMElement mapValue = fac.createOMElement("map-Value", omNs);
OMElement valElement = fac.createOMElement("std-String", omNs);
OMAttribute valAttribute = fac.createOMAttribute("value", null, val);
mapValue.addChild(valElement);
valElement.addAttribute(valAttribute);
// attach to map-Entry
mapEntry.addChild(mapKey);
mapEntry.addChild(mapValue);
return mapEntry;
}
}
But everytime getting response as :-
<Response><map-Map>
<map-Entry>
<map-Key>
<std-String value="errorMessage" />
</map-Key>
<map-Value>
<null />
</map-Value>
</map-Entry>
</map-Map></Response>
Is there anyone who can help us out?
Please use the forum's bbcode tags to make your post more readable:
for php code............[php] <?php /* code goes here */ ?> [/php]
for html...............[html] <!-- markup goes here -->.....[/html]
for js/css/other.......[code] code goes here................[/code]
Also, please start a new thread if you want to ask a question!
Bookmarks