问题描述
我的工作是开发一个解决方案,实时将jobOffer从我们的平台发布到Monster。我们发现Monster为它提供了一个API和一个商业网关。
我们继续添加一个Web引用,我使用了该服务的方法,但返回的对象为null,如果请求成功发送,我无法查询。
是否有人已经使用过这个API来帮助我:这是我的代码
公共类sendFile:System.Web.UI.Page
{
公共字符串调用()
{
System.Net.ServicePointManager.ServerCertificateValidationCallback + =
(s,cert,chain,sslPolicyErrors)=> true;
//服务类
com.monster.schemas.MonsterBusinessGatewayService gateway = new MonsterBusinessGatewayService();
$ / b
RecruiterReferenceType rec = new RecruiterReferenceType();
CompanyAuthHeader comp = new CompanyAuthHeader();
Security1 security = new Security1();
MonsterHeader monster = new MonsterHeader();
UsernameTokenType1 user = new UsernameTokenType1();
//工作
job.RecruiterReference = rec;
var r = rec.UserName =xtestxftp;
job.RecruiterReference.UserName = r;
job.jobRefCode =testJob;
job.JobInformation = info;
info.JobTitle =软件工程师;
info.JobBody = BodyType;
var v = BodyType.Value =intersting job ppppppppppppppppp;
//发布统计数据
PostingStats postS = new PostingStats();
Postingtype.PostingStats = postS;
var nb = postS.Views;
var nbApp = postS.SeekerApps;
// Business Gataway paramaters
gateway.Url =https://gateway.monster.com:8443/bgwBroker;
gateway.Proxy = proxy;
proxy.Credentials = cre;
gateway.UseDefaultCredentials = true;
gateway.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
gateway.Security = security;
security.UsernameToken = user;
user.Password = pass;
gateway.Security.UsernameToken.Username =xrtpjobsx01;
gateway.Security.UsernameToken.Password.Va lue =rtp987654;
JobsResponse jobresp = new JobsResponse();
jobresp = gateway。 UpdateJob(工作);
JobResponse [] jobres = new JobResponse [10];
jobresp.JobResponse = jobres;
jobres [1] = jobresponse;
JobCharge [] jobchrg = new JobCharge [10];
jobresponse.JobCharges = jobchrg;
//jobresponse.JobPostingResponse [ 1] .JobViewURL =
jobchrg [1] =工作费用;
string postId = jobcharge.postingId;
var requestXmlFile = XMLSerializerClass.SerializeSOAPFile( job,C:/Users/DELL/Desktop/req.xml);
var ResponseXmlFile = XMLSerializerClass.SerializeSOAPFile(jobresp,C:/Users/DELL/Desktop/resp.xml) ;
返回postId;
}
}
My work is to develop a solution for real time posting jobOffer from our platform to Monster . we found that Monster provides an API for that and a Business Gateway .
we proceed by adding a web reference and I used method from the service , but the object returned is null and I can't consult if the the request is successfully sent or not .
Is there someone who already worked with thie API to help me : here is my code
public class sendFile : System.Web.UI.Page
{
public string call()
{
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
(s, cert, chain, sslPolicyErrors) => true;
//service class
com.monster.schemas.MonsterBusinessGatewayService gateway = new MonsterBusinessGatewayService();
RecruiterReferenceType rec = new RecruiterReferenceType();
CompanyAuthHeader comp = new CompanyAuthHeader();
Security1 security = new Security1();
MonsterHeader monster = new MonsterHeader();
UsernameTokenType1 user = new UsernameTokenType1();
//Job
job.RecruiterReference = rec;
var r = rec.UserName = "xtestxftp";
job.RecruiterReference.UserName = r;
job.jobRefCode = "testJob";
job.JobInformation = info;
info.JobTitle = "software engineer";
info.JobBody = BodyType;
var v = BodyType.Value = "intersting job ppppppppppppppp ";
// posting Stats
PostingStats postS = new PostingStats();
Postingtype.PostingStats = postS;
var nb = postS.Views;
var nbApp = postS.SeekerApps;
//Business Gataway paramaters
gateway.Url = "https://gateway.monster.com:8443/bgwBroker";
gateway.Proxy = proxy;
proxy.Credentials = cre;
gateway.UseDefaultCredentials = true;
gateway.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
gateway.Security = security;
security.UsernameToken = user;
user.Password = pass;
gateway.Security.UsernameToken.Username = "xrtpjobsx01";
gateway.Security.UsernameToken.Password.Value = "rtp987654";
JobsResponse jobresp = new JobsResponse();
jobresp = gateway.UpdateJob(job);
JobResponse[] jobres = new JobResponse[10];
jobresp.JobResponse = jobres;
jobres[1] = jobresponse;
JobCharge[] jobchrg = new JobCharge[10];
jobresponse.JobCharges = jobchrg;
//jobresponse.JobPostingResponse[1].JobViewURL =
jobchrg[1] = jobcharge;
string postId = jobcharge.postingId;
var requestXmlFile = XMLSerializerClass.SerializeSOAPFile(job, "C:/Users/DELL/Desktop/req.xml");
var ResponseXmlFile = XMLSerializerClass.SerializeSOAPFile(jobresp, "C:/Users/DELL/Desktop/resp.xml");
return postId;
}
}
推荐答案
这篇关于使用Monster实时发布API和业务网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!