Development and Test Environment
These examples have been tested on a machine with JDK 1.8 version and developed at Eclipse IDE for Java EE Developers (Oxygen 2). Download the installation here and choose Eclipse IDE for Java EE Developers to install it on your computer.
Creating a Java Project in Eclipse
This chapter explains the steps creating a new Java project.
Run “Eclipse”.
Go to “File” menu.
Select "New" - “Java Project”.
Enter a project name "CWS" and click the “Finish” button.
A new project will be created with the given name.
Setting a Web Service Client up
This chapter explains the steps setting up a web service client in your new Java project.
Click mouse right button on the project name under the Package Explorer.
Click the [New] - [Other ...].
Enter “Web Service” at wizards input box.
Select “Web Service Client“, then click “Next” button.
Enter http://e3.sap.cubemaster.net/calculation.svc?singlewsdl to the “Service definition” input box.
Define the “Develop client” as shown in the screen shot.
Then click the “Finish” button.
New packages and classes will be created automatically.




Adding a Main Class Package and Class
Click the mouse right button on “scr” package.
Click the “Package” on popup menu.
Enter Package name “org.main” at Name input box.Go to “org.main” package and then click the mouse right button.
Click the [New]-[Class].
Enter class name at name input box.
Check automatically method .
Select public static void main(String[] args).
Then click “Finish” button.
Main class will be generated automatically as screen shot.
Firstly, import all packages(Package Name org.tempuri.*,org.datacotract.schemas.*).
Write a try-catch statement in the main method.
Editing the Main Class Package and Class
Main class will be generated automatically as screen shot.
package org.main;
import org.tempuri.*;
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.axis.encoding.Base64;
import org.datacontract.schemas._2004._07.CubeMasterWebService.*;
public class LoadBuildingSample {
public static void main(String[] args) {
try {
} catch (Exception e) {
// TODO Auto-generated catch block
}
}
}
Import all packages (Package Name org.tempuri.*,org.datacotract.schemas.*).
Write a try-catch statement in the main method.
Add new statements to define the shipment information for the calculation. Define “Account”, “Shipment”, and “Options”. Define two cargoes. Define “Container” and “Shipment” rules.
Add new statements to send the shipment information to the CubeMaster service servers.
Add a try-catch statements to look up the results by seeing if “getStatus()” returns “OK”.
Add new statements to produce an image in a try-catch statement from the results.
Add cleanup statements.
package org.main;
import org.tempuri.*;
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.axis.encoding.Base64;
import org.datacontract.schemas._2004._07.CubeMasterWebService.*;
public class LoadBuildingSample {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
ICalculationProxy iCalculationProxy = new ICalculationProxy();
//Define account information
//Please replace with the information of your account
Account account = new Account();
account.setUserID("chang@logen.co.kr");
account.setPassword("****");
account.setCompany("Logen Solutions");
//Define options
Options options = new Options();
options.setCalculationSaved(true);
options.setGraphicsCreated(true);
options.setGraphicsImageWidth((short) 300);
options.setGraphicsImageDepth((short) 300);
options.setThumbnailsCreated(true);
options.setThumbnailsImageWidth((short) 300);
options.setThumbnailsImageDepth((short) 300);
options.setUOM(1);//1=mm+Kg, 0=inch+lbs, 2=Cm+Kg
//Define shipment
Shipment shipment = iCalculationProxy.getShipment();
shipment.setTitle("New Shipment Sample for Vehicle Load v2");
shipment.setDescription("in Java Eclipse");
//Define two cargoes
Cargo[] Cargoes = new Cargo[3];
Cargoes[0] = new Cargo();
Cargoes[0].setName("First Cargo");
Cargoes[0].setLength(500);//mm
Cargoes[0].setWidth(500);//mm
Cargoes[0].setHeight(500);//mm
Cargoes[0].setQty((long) 40);
Cargoes[0].setSequence(1);
Cargoes[0].setGroupName("B");
Cargoes[0].setWeight(47.12);//kg
Cargoes[0].setColorKnownName("BLUE");
Cargoes[0].setFloorStackSupportsOthers(true);
Cargoes[1] = new Cargo();
Cargoes[1].setName("Second Cargo");
Cargoes[1].setLength(700);//mm
Cargoes[1].setWidth(800);//mm
Cargoes[1].setHeight(700);//mm
Cargoes[1].setQty((long) 156);
Cargoes[1].setSequence(2);
Cargoes[1].setGroupName("A");
Cargoes[1].setWeight(50.00);//kg
Cargoes[1].setColorKnownName("RED");
Cargoes[1].setFloorStackSupportsOthers(true);
Cargoes[2] = new Cargo();
Cargoes[2].setName("Third Cargo");
Cargoes[2].setLength(600);//mm
Cargoes[2].setWidth(550);//mm
Cargoes[2].setHeight(860);//mm
Cargoes[2].setQty((long)45);
Cargoes[2].setSequence(2);
Cargoes[2].setGroupName("A");
Cargoes[2].setWeight(12.00);//kg
Cargoes[2].setOrientationsAllowed(63);
Cargoes[2].setColorKnownName("YELLOW");
//Cargoes[2].setColorHexaCode("#FF00FF");
Cargoes[2].setFloorStackSupportsOthers(false);
shipment.setCargoes(Cargoes);
//Define containers
Container[] EmptyContainers = new Container[2];
EmptyContainers[0] = new Container();
EmptyContainers[0].setContainerType(2);//2=SeaContainer
EmptyContainers[0].setName("20FT Dry");
EmptyContainers[0].setLength((double) 5890);//mm
EmptyContainers[0].setWidth((double) 2330);//mm
EmptyContainers[0].setHeight((double) 2380);//mm
EmptyContainers[0].setMaxWeight((double) 5000);//kg
EmptyContainers[1] = new Container();
EmptyContainers[1].setContainerType(2);//2=SeaContainer
EmptyContainers[1].setName("40FT Dry");
EmptyContainers[1].setLength((double) 12050);//mm
EmptyContainers[1].setWidth((double) 2330);//mm
EmptyContainers[1].setHeight((double) 2380);//mm
EmptyContainers[1].setMaxWeight((double) 7000);//kg
shipment.setContainers(EmptyContainers);
//Define Rules
shipment.getRules().setIsWeightLimited(true);
shipment.getRules().setIsSequenceUsed(false);
shipment.getRules().setIsGroupUsed(false);
shipment.getRules().setIsSafeStackingUsed(true);
shipment.getRules().setMinSupportRate((double) 60);
shipment.getRules().setStackingRule(5);
shipment.getRules().setFillDirection(1);
//Run the calculation
LoadPlan loadPlan = iCalculationProxy.run(shipment, account, options);
//Show the return
System.out.println(loadPlan.getStatus());
//Show an error code if any
System.out.println(loadPlan.getCalculationError());
if(loadPlan.getStatus().equals("OK")) {
//Access the results
System.out.println("# of Containers =" + loadPlan.getFilledContainers().length);
InputStream is = null;
OutputStream os = null;
//Show all filled containers
try {
for (FilledContainer container : loadPlan.getFilledContainers()) {
//show the name of the container
System.out.println(container.getName());
System.out.println(container.getLength());
} // End of foreach - FilledContainer
} catch (Exception e) {
// TODO: handle exception
} finally { //Resource Cleanup
if(is != null) {
try {
is.close();
os.close();
} catch(IOException e) {
e.printStackTrace();
}
}
} // end of try-catch statement .. for Show all filled containers
} //LoadPlan.Status == "OK"
System.exit(0);
} catch (Exception e) {
// TODO: handle exception
}
}
}
very good post, i surely love this excellent website, keep on it slot gacor
This post post made me think. I will write something about this on my blog. Have a nice day!Ritatrend
you have a great weblog here! do you need to have invite posts in my small blog? office furniture
Well-written article. It's incredibly supportive for anyone who uses it, including me. I can't stop reading your posts. Thanks for the valuable help. كيف تسافر إلى نيوزيلندا في 10 أيام
Your recent post on Surgical Associates of Southern TX was fantastic! It’s clear that you put a lot of thought and effort into it, making it an invaluable resource for the <a href="https://www.surgicalstx.com/services/appendicitis-surgery-in-houston-usa/">appendix specialist near me</a> industry in Houston. Your blog is always a go-to for insightful content, and I can’t wait to see what you share next. Keep up the great work!
I have been meaning to post something like this on my blog and you have given me an idea. Cheers. poker online
Hello! I wish to offer a large thumbs up for that fantastic information you’ve here about this post. I am returning to your blog post to get more soon. situs slot
It’s difficult to get knowledgeable individuals on this topic, however you seem like there’s more you’re discussing! Thanks Australian travel guide
I enjoy just taking a break from studying and visiting your blog. I just wish you posted more regularly. situs slot
I’m impressed, I have to admit. Really rarely can i encounter a weblog that’s both educative and entertaining, and let me tell you, you might have hit the nail to the head. Your idea is outstanding; the problem is something not enough folks are speaking intelligently about. I am delighted i found this around my look for something in regards to this. toto slot
Wow that was unusual. I just wrote an very long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyway, just wanted to say fantastic blog! 除甲醛
Thank you for your own hard work on this website. Ellie enjoys conducting investigation and it is obvious why. All of us learn all of the compelling mode you produce simple tricks through this blog and as well cause participation from other ones about this area of interest then our daughter is now starting to learn a lot of things. Take advantage of the rest of the new year. You have been conducting a very good job.Supreme Hoodie
I appreciate you sharing this interesting article, and I'm glad I found your page through Google. Not just the material, but the entire website is excellent. visa for bolivia
Hello! I merely would choose to make a enormous thumbs up for that excellent information you may have here for this post. I’ll be returning to your blog for much more soon. Bolabosku
Read carefully the complete short article. There is certainly some definitely insightful data here. thanks. “The soul is the captain and ruler of the life of morals.” by Sallust.. 除蟑螂
You have mentioned very interesting details ! ps decent web site . agen togel
I want assembling utile info, this post has got me even more info! . situs togel
The design of ventsedgemakes it a pleasure to use.
The passion behind bulleyes.blog’s content is evident.
Every visit to hardcorebuzz is worth it!