/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package tester;
import LOGIN_SERVIntf.TLoginData;
import java.io.File;
import java.security.MessageDigest;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import parser.*;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.Stub;
import javax.xml.rpc.holders.BooleanHolder;
import javax.xml.rpc.holders.IntHolder;
import javax.xml.rpc.holders.StringHolder;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.axis.message.SOAPHeaderElement;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import uExhibitClasses.*;
import uExhibitClasses.holders.*;
/**
*
* @author Admin
*/
public class Main {
public static void main(String[] args){
/*ParserWSDL parser=new ParserWSDL();
parser.readWSDL(new File(".\\IExhibitSrv.wsdl"));
parser.transformWSDL();
parser.writeWSDL(new File(".\\IExhibitSrvNew.wsdl"));*/
/*try{
Stub stub=(Stub)(new pack.IExhibitSrvservice_Impl().getIExhibitSrvPort());
stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://212.98.183.107/scripts/ExhibitSrv.dll/soap/ILOGIN_SERV");
pack.IExhibitSrv_Stub s=(pack.IExhibitSrv_Stub)stub;
pack.TExchangeSettings a=s.getExchangeSettings();
System.out.println(a.getDecimalSeparator());
}catch(Exception e){
e.printStackTrace();
}*/
try {
//Stub stub=(Stub)(new org.tempuri.IExhibitSrvserviceLocator().getIExhibitSrvPort());
//org.tempuri.IExhibitSrvbindingStub s=(org.tempuri.IExhibitSrvbindingStub)stub;
Stub stub=(Stub)(new org.tempuri.ILOGIN_SERVserviceLocator().getILOGIN_SERVPort());
org.tempuri.ILOGIN_SERVbindingStub s=(org.tempuri.ILOGIN_SERVbindingStub)stub;
/*uExhibitClasses.TExchangeSettings a=s.getExchangeSettings();
System.out.println(a.getDecimalSeparator());
System.out.println(a.getDataRefreshTime());
System.out.println(a.getDateSeparator());
System.out.println(a.getShortDateFormat());
System.out.println(a.getShortTimeFormat());
System.out.println("--------");
StringHolder s1=new StringHolder();
StringHolder s2=new StringHolder();
StringHolder s3=new StringHolder();
s.navigateBySellCatalogue(10657,s1,s2,s3,new BooleanHolder());
//System.out.println(s1.value);
//System.out.println(s2.value);
//System.out.println(s3.value);
IntHolder i1=new IntHolder();
IntHolder i2=new IntHolder();
StringHolder s4=new StringHolder();
StringHolder s5=new StringHolder();
StringHolder s6=new StringHolder();
StringHolder s7=new StringHolder();
s.navigateByOffers(7503, "\n\n", i1, i2, s4, s5, s6, s7, new BooleanHolder());
System.out.println("--------");
System.out.println(i1.value);
System.out.println(i2.value);
System.out.println(s4.value);
System.out.println(s5.value);
System.out.println(s6.value);
System.out.println(s7.value);*/
TLoginData loginData=new TLoginData();
loginData.setLogin("s.startsev");
String text = "1";
String md5 = null;
try {
StringBuffer code = new StringBuffer();
MessageDigest messageDigest =
MessageDigest.getInstance("MD5");
byte bytes[] = text.getBytes();
byte digest[] = messageDigest.digest(bytes);
for (int i = 0; i < digest.length; ++i) {
code.append(Integer.toHexString(0x0100 +
(digest[i] & 0x00FF)).substring(1));
}
md5 = code.toString();
} catch (Exception e) {
System.out.println(e);
}
System.out.println(md5);
loginData.setPwdHash(md5);
loginData.setLocalIP("93.85.154.8");
loginData.setMACAddress("00-53-45-00-00-00");
StringHolder str=new StringHolder();
IntHolder res=new IntHolder();
s.serv_LogIn(loginData, new IntHolder(), str, res);
System.out.println(str.value);
/*System.out.println("--------");
System.out.println("--------");
String str=new String();
int b = 0;
double d = 0;
TFullOfferInfo i= new TFullOfferInfo(str,str,b,str,str,d,str,d,str,d,str,str,str,str,str,str,str,b,new GregorianCalendar(),str,b,b,b,b,new TBid[5],new GregorianCalendar(),new TPhoto[5]);
TFullOfferInfoHolder info=new TFullOfferInfoHolder(i);
s.setHeader("urn:uExhibitSrvIntf", "TAuthHeader", "sss");
s.getFullOfferInfo(3370, info);
System.out.println(info.value.getAct());
System.out.println(info.value.getBidsCount());
System.out.println(info.value.getCategoryID());
System.out.println(info.value.getCategoryName());
System.out.println(info.value.getCodeTNVED());
System.out.println(info.value.getCountryMade());
System.out.println(info.value.getCountryName());
System.out.println(info.value.getCurrency());
System.out.println(info.value.getDateEnd());
System.out.println(info.value.getDeliveryCondition());
System.out.println(info.value.getDeliveryPeriod());
System.out.println(info.value.getEdIzm());
System.out.println(info.value.getFirmMade());
System.out.println(info.value.getLocation());
System.out.println(info.value.getLotValue());
System.out.println(info.value.getNameOffer());
System.out.println(info.value.getOfferInfo());
System.out.println(info.value.getOfferStatus());
System.out.println(info.value.getPayCondition());
System.out.println(info.value.getPrice());
System.out.println(info.value.getTimeLeftStr());*/
} catch (Exception ex) {
System.out.println(ex);
if(ex instanceof AxisFault){
((AxisFault)ex).printStackTrace();
}
}
/*try{
//ServiceFactory sf =ServiceFactory.newInstance();
Service serv =new Service();//sf.createService(new QName("CalcWSService"));
//QName port = new QName("CalcWSPort");
//Call call = serv.createCall(port);
Call call=(Call)serv.createCall();
//call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
//call.setTargetEndpointAddress("http://localhost:8080/CalcService/CalcWS");
call.setTargetEndpointAddress("http://212.98.183.107/scripts/ExhibitSrv.dll/soap/IExhibitSrv");
call.setOperationName(new QName("GetExchangeSettings"));
QName qn = new QName("urn:uExhibitClasses", "TExchangeSettings");
call.registerTypeMapping(pack.TExchangeSettings.class, qn,
new BeanSerializerFactory(pack.TExchangeSettings .class, qn),
new BeanDeserializerFactory(pack.TExchangeSettings .class, qn));
//call.addParameter("arg1", qn, ParameterMode.IN);
call.setReturnType(qn, pack.TExchangeSettings.class);
Boolean r=(Boolean)call.invoke(new Object[]{});
System.out.println(r);
}catch(Exception e){
System.out.println(e);
e.printStackTrace();
/*if(e instanceof AxisFault){
AxisFault f=(AxisFault)e;
//System.out.println(f.dumpToString());
Element[] el=f.getFaultDetails();
System.out.println(el.length);
for(int i=0;i<el.length;i++){
NamedNodeMap map=el[i].getAttributes();
for(int j=0;j<map.getLength();j++){
System.out.println(map.item(j));
}
}
}*/
//}
}
}